oop + lecture01
DESCRIPTION
OOPTRANSCRIPT
Object-Oriented Object-Oriented Programming (OOP)Programming (OOP)
Lecture No. 1Lecture No. 1
Course ObjectiveCourse Objective
►Objective of this course is to make Objective of this course is to make students familiar with the concepts of students familiar with the concepts of object-oriented programmingobject-oriented programming
►Concepts will be reinforced by their Concepts will be reinforced by their implementation in C++implementation in C++
Course ContentsCourse Contents
►Object-OrientationObject-Orientation►Objects and ClassesObjects and Classes►OverloadingOverloading► InheritanceInheritance►PolymorphismPolymorphism►Generic ProgrammingGeneric Programming►Exception HandlingException Handling► Introduction to Design PatternsIntroduction to Design Patterns
BooksBooks
►C++ How to ProgramC++ How to ProgramBy Deitel & DeitelBy Deitel & Deitel
►The C++ Programming LanguageThe C++ Programming LanguageBy Bjarne StroustrupBy Bjarne Stroustrup
►Object-Oriented Software EngineeringObject-Oriented Software EngineeringBy Jacobson, Christerson, Jonsson, OvergaardBy Jacobson, Christerson, Jonsson, Overgaard
Grading PolicyGrading Policy
►AssignmentsAssignments 10 %10 %►ProjectProject 10 % 10 %►Quiz & HW 10 %Quiz & HW 10 %► Mid-TermMid-Term 30 % 30 %►FinalFinal 40 % 40 %
Object-Orientation (OO)Object-Orientation (OO)
What is Object-Orientation?What is Object-Orientation?
►A technique for system modelingA technique for system modeling
►OO model consists of several OO model consists of several interacting objectsinteracting objects
What is a Model?What is a Model?
►A model is an abstraction of somethingA model is an abstraction of something
►Purpose is to understand the product Purpose is to understand the product before developing itbefore developing it
Examples – ModelExamples – Model
►Highway mapsHighway maps
►Architectural modelsArchitectural models
►Mechanical modelsMechanical models
Example – OO ModelExample – OO Model
……Example – OO ModelExample – OO Model
►ObjectsObjects AliAli HouseHouse CarCar TreeTree
► InteractionsInteractions Ali lives in the houseAli lives in the house Ali drives the carAli drives the car
Ali
Car
House
Tree
lives-in
drives
Object-Orientation - Object-Orientation - Advantages Advantages
►People think in terms of objectsPeople think in terms of objects
►OO models map to realityOO models map to reality
►Therefore, OO models areTherefore, OO models are easy to developeasy to develop easy to understandeasy to understand
What is an Object?What is an Object?
An object isAn object is
►Something tangible (Ali, Car)Something tangible (Ali, Car)
►Something that can be apprehended Something that can be apprehended intellectually (Time, Date)intellectually (Time, Date)
… … What is an Object?What is an Object?
An object hasAn object has
►State (attributes)State (attributes)►Well-defined behaviour (operations)Well-defined behaviour (operations)►Unique identityUnique identity
Example – Ali is a Tangible Example – Ali is a Tangible ObjectObject
►State (attributes)State (attributes) NameName AgeAge
►behaviour (operations)behaviour (operations) WalksWalks EatsEats
► IdentityIdentity His nameHis name
Example – Car is a Tangible Example – Car is a Tangible ObjectObject
►State (attributes)State (attributes)- Color- Color
- Model- Model
►behaviour (operations)behaviour (operations)- Accelerate- Accelerate - Start Car- Start Car
- Change Gear- Change Gear
► IdentityIdentity- Its registration number- Its registration number
Example – Time is an Object Example – Time is an Object Apprehended IntellectuallyApprehended Intellectually
►State (attributes)State (attributes)- Hours- Hours - Seconds- Seconds
- Minutes- Minutes
►behaviour (operations)behaviour (operations)- Set Hours- Set Hours - Set Seconds- Set Seconds
- Set Minutes- Set Minutes► IdentityIdentity
- Would have a unique ID in the model- Would have a unique ID in the model
Example – Date is an Object Example – Date is an Object Apprehended IntellectuallyApprehended Intellectually
►State (attributes)State (attributes)- YearYear - Day- Day- MonthMonth
►behaviour (operations)behaviour (operations)- Set Year- Set Year - Set Day- Set Day
- Set Month- Set Month
► IdentityIdentity- Would have a unique ID in the model- Would have a unique ID in the model