Docsity

Object Oriented Programming Introduction, Study notes of Object Oriented Programming

Partial preview of the text

Download Object Oriented Programming Introduction and more Study notes Object Oriented Programming in PDF only on Docsity!

Object Oriented

Programming

Introduction

About the course

  • (^) Credit hours: 3 + 1
  • (^) Pre-requisites: Introduction to Programming
  • (^) Textbook
    • (^) Object Oriented Programming in C++ by Robert Lafore
  • (^) Reference books
    • (^) C++ How To Program, Deitel and Deitel
    • (^) Thinking in C++ by Bruce Eckel
    • Attendance : Should be >= 80%. You will not be allowed to sit in examination otherwise.

Lecture Slides

  • Course lecture slides will be made available in PowerPoint format to CR
  • (^) However, possessing/reading these notes is not a suitable substitute for attending lectures
  • Book Reading is a key to success

Student Evaluation

  • (^) Assignments (15 marks)
    • (^) Assignments submitted after the due date will either be rejected altogether or heavily penalized
  • (^) Quizzes (15 marks)
    • (^) Quizzes (mostly unannounced) will be conducted quite frequently and any missed quizzes will not be re-conducted
  • MidTerm (45 marks)
  • (^) Lab (50 marks)
  • Final (75 marks)

My expectations

  • Arrive on time
  • Maintain class discipline
  • Don’t Keep your mobile phones
  • Actively participate in class discussion

Programming paradigms

  • From Unstructured to Structured
  • From Structured to Object Oriented

Unstructured Programming

  • This programming technique provides tremendous disadvantages once the program gets sufficiently large
  • (^) For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied
  • This has lead to the idea of extracting these sequences, naming them and offering a technique to call and return from these procedures

Procedural Programming

  • Combine returning sequences of statements into one single place
  • (^) A procedure call is used to invoke the procedure
  • (^) After the sequence is processed, flow of control proceeds right after the position where the call was made

Procedural Programming

  • (^) Now we have a single program which is divided into small pieces called procedures
  • (^) To enable usage of general procedures or groups of procedures also in other programs, they must be separately available
  • (^) For that reason, modular programming allows grouping of procedures into modules

Modular Programming

  • During the 1970s it became clear that even well-structured programs were not enough for mastering the complexity involved in developing a large program system
  • (^) It was also recognized that it was necessary to support the division of the program into well-defined parts or modules, that could be developed and tested independently of one another, so that several people could work together within one large programming project
  • (^) Modular programming is thus concerned with the subdivision of programs into manageable "chunks"

Modular Programming

Each module can have its own data and functions

Unstructured, procedural, modular programming Unstructured programming. The main program directly operates on data Procedural programming. The main program coordinates calls to procedures and hands over appropriate data as parameters Modular programming. The main program coordinates calls to procedures in separate modules and hands over appropriate data as parameters

Object Oriented Programming

  • (^) In the OOP approach, data and the functions, which are supposed to have the access to the data, are packed together into one box known as an object
  • (^) Objects of the program interact by sending messages to each other

Object-Oriented Terminology. ...

  • Classes and Objects major building blocks of OOP
  • A class is a definition of an object. It's a type just like int
  • A class is used as a template or pattern to create new objects (instances of the class)
  • a class describes the contents of the objects that belong to it.
  • object: an object is an element (or instance) of a class; objects have the behaviors of their class.