290 likes | 418 Vues
This course introduces object-oriented programming (OOP) as a fundamental methodology for software design. It emphasizes the idea that everything in our world can be viewed as an object, from biological entities like flowers and animals to abstract concepts such as educational and economic systems. Key OOP principles including classes, inheritance, polymorphism, and encapsulation will be covered. The emphasis will be on decomposing complex problems into manageable parts through objects, facilitating easier problem-solving and system evolution.
E N D
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 SWE 316- Ahmed Youssef
Why Object Oriented? Decomposition of the large problem into small parts that can be solved separately. Large Application SWE 316- Ahmed Youssef
Object-Oriented Concept • Object & Class • Inheritance • Polymorphism • Encapsulation 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, … SWE 316- Ahmed Youssef
Object 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 SWE 316- Ahmed Youssef
Procedure Program view Main Program Data Procedure3 Procedure2 Procedure1 SWE 316- Ahmed Youssef
Main Program(Also a module) Data Module2 + Module1 + Data Data Data1 Data1 Data Data2 Procedure2 Procedure3 Procedure1 The main program coordinates calls to procedures inseparate modules and hands over appropriate data as parameters. SWE 316- Ahmed Youssef
Object1 Data1+Procedures1 Object2 Data2 +Procedures2 Data Data1 Object3 Data3 +Procedures3 Object4 Data4 +Procedures4 SWE 316- Ahmed Youssef
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 SWE 316- Ahmed Youssef
Class Student Ahmed Majed Salem Saad SWE 316- Ahmed Youssef
Class Tennis Player Bandar Mosaed Nayef Khaled SWE 316- Ahmed Youssef
Class Institute Social Technology Engineering Science Agricultural Technology SWE 316- Ahmed Youssef
Class SWE 316- Ahmed Youssef
Class SWE 316- Ahmed Youssef
Class SWE 316- Ahmed Youssef
Class SWE 316- Ahmed Youssef
Class SWE 316- Ahmed Youssef
Object & Class SWE 316- Ahmed Youssef
Object & Class Student Ahmed Majed Salem Saad SWE 316- Ahmed Youssef
Object & Class Student Ahmed Majed Salem Saad SWE 316- Ahmed Youssef
Building Class Attributes Any Thing Behavior SWE 316- Ahmed Youssef
Student- Class Fname string Lname string Student_ID string Print_info Input: - return: void Level int Program string Update_info Input: name or ID Return : void Tel string Gender string
1. Create objects from class 3. Manage object 2. objects Obj1 Obj3 Obj2 Obj4
Student Class Instance variable Constructor Constructor
Student Class Overloaded Method Method