Introduction to Object Orientation Dr. Ahmed Youssef
Object-Orientation It is a kind of thinking methodology Everything in the world is an object; Any system is composed of objects; The evolution and development of a system is caused by the interactions among the objects inside or outside the system 2 SWE 316- Ahmed Youssef
Decomposition of the large problem into small parts that can be solved separately. Why Object Oriented? Large Application 3 SWE 316- Ahmed Youssef
Object-Oriented Concept Object & Class Inheritance Polymorphism Encapsulation 4 SWE 316- Ahmed Youssef
Everything in the world is an object A flower, a tree, an animal A student, a professor A desk, a chair, a classroom, a building A university, a city, a country The world, the universe A subject such as CS, SWE, Math, History, … 5 SWE 316- Ahmed Youssef
Object 6 SWE 316- Ahmed Youssef
Any system is composed of objects A cultural system An educational system An economic system An Information system A computer system 7 SWE 316- Ahmed Youssef
Procedure Program view Main Program Data Procedur e 1 Procedur e 2 Procedur e 3 8 SWE 316- Ahmed Youssef
Main Program(Also a module) Data Data 1 Module 2 + DataData 2 Module 1 + DataData 1 Procedure 1 Procedure 2 The main program coordinates calls to procedures in separate modules and hands over appropriate data as parameters. Procedure 3 9 SWE 316- Ahmed Youssef
Object 1 Data 1 +Procedures 1 DataData 1 Object 3 Data 3 + Procedures 3 Object 2 Data 2 + Procedures 2 Object 4 Data 4 + Procedures 4 10 SWE 316- Ahmed Youssef
11 Classes objects sharing common characteristics contain state: attributes, fields, variables, data member behavior: functions, methods SWE 316- Ahmed Youssef
Class Person Ahmed Majed Salem Saad 12 SWE 316- Ahmed Youssef
Class Student Ahmed Majed Salem Saad 13 SWE 316- Ahmed Youssef
Class Tennis Player Bandar Mosaed Nayef Khaled 14 SWE 316- Ahmed Youssef
Class Institute Social Technology Engineering Science Agricultural Technology 15 SWE 316- Ahmed Youssef
Class Name Attributes Operations … 16 SWE 316- Ahmed Youssef
Class Student StudentID FirstName LastName Address etc… RegisterForCourse DropCourse etc SWE 316- Ahmed Youssef
Class Tennis Player FirstName LastName Nationality Ranking etc… RegisterForTournament etc SWE 316- Ahmed Youssef
Class Car Car Reg. Number Maker Model Color etc… Accelerate Stop etc SWE 316- Ahmed Youssef
Class Airplane Plane Number Manufacturer Model etc… TakeOff Landing etc SWE 316- Ahmed Youssef
21 Object & Class SWE 316- Ahmed Youssef
Object & Class Student StudentID FirstName LastName Address etc… RegisterForCourse DropCourse etc... Student Ahmed Majed Salem Saad 22 SWE 316- Ahmed Youssef
Object & Class Student1 B Ahmed Alfgdfg 7146 sdasds7 etc… RegisterForCourse DropCourse etc... Student Ahmed Majed Salem Saad 23 SWE 316- Ahmed Youssef
Student1 B Ahmed Alfgdfg 7146 sdasds7 etc… RegisterForCourse DropCourse etc... Student StudentID FirstName LastName Address etc… RegisterForCourse DropCourse etc SWE 316- Ahmed Youssef
Building Class SWE 316- Ahmed Youssef 25 Any Thing Attribute s Behavior
Student- Class 26
Main Class Student Class 3. Manage object 1. Create objects from class Obj 1 Obj 2 Obj 3 Obj 4 2. objects 27
Student Class Instance variableConstructor 28
Method Overloaded Method Student Class 29