Object-Oriented Programming (OOP) Lecture No. 3. Abstraction ► Abstraction is a way to cope with complexity. ► Principle of abstraction: “Capture only.

Slides:



Advertisements
Similar presentations
Informática II Prof. Dr. Gustavo Patiño MJ
Advertisements

Chapter 7 Testing Class Hierarchies. SWE 415 Chapter 7 2 Reading Assignment  John McGregor and David A. Sykes, A Practical Guide to Testing Object-Oriented.
Inheritance & Classification Hierarchies Lecture-8.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Chapter 10 Introduction to Objects and Classess 1.
The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
Object-Oriented Programming (OOP) Lecture No. 6
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
Object-oriented analysis (OOA) techniques are used to (1) study existing objects to see if they can be reused or adapted for new uses, and (2) define new.
1 Software Testing and Quality Assurance Lecture 28 – Testing Class Hierarchies.
Fall 2007ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
1 Inheritance Inheritance is a natural way to model the world in object-oriented programming. It is used when you have two types of objects where one is.
Chapter 10: Inheritance 1. Inheritance  Inheritance allows a software developer to derive a new class from an existing one  The existing class is called.
(c) University of Washington03-1 CSC 143 Java Inheritance Reading: Ch. 10.
2.5 OOP Principles Part 1 academy.zariba.com 1. Lecture Content 1.Fundamental Principles of OOP 2.Inheritance 3.Abstraction 4.Encapsulation 2.
2.5 OOP Principles Part 2 academy.zariba.com 1. Lecture Content 1.Polymorphism 2.Cohesion 3.Coupling 2.
Svetlin Nakov Telerik Corporation
Using Jeroo To Teach Object-Oriented Concepts By Christian Digout.
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
Object Oriented Programming Lecturer: Andreas P. Adi
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 18. Review User interface Design principles Design Guidelines.
School of Computer Science & Information Technology G6DICP - Lecture 22 The Theory of Object Oriented Programming.
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Downloaded From:  Objective of this course is to make students familiar with the concepts of object-oriented programming  Concepts.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.
Object-Oriented Programming (OOP) Lecture No. 4. Recap – Inheritance ► Derived class inherits all the characteristics of the base class ► Besides inherited.
SNPL1 Woochang Lim What (Variable) + How (Function) = Object Objects are the physical and conceptual things we find in the universe around us. Object-Oriented.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
Polymorphism, Abstraction and Virtual Functions. In this slide, we introduce virtual functions and two complex and powerful uses for derived classes that.
CSC241 Object-Oriented Programming (OOP) Lecture No. 1.
Object-Oriented Design Justin Callanan CS 597. Object-Oriented Basics ● Data is stored and processed in “objects” ● Objects represent generalized real.
CSC241 Object-Oriented Programming (OOP) Lecture No. 3.
S.Ducasse Stéphane Ducasse 1 Object-Oriented Programming.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
CSCI-383 Object-Oriented Programming & Design Lecture 10.
OOP (Object Oriented Programming) Lecture 1. Why a new paradigm is needed? Complexity Five attributes of complex systems –Frequently, complexity takes.
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
Inheritance CSI 1101 Nour El Kadri. OOP  We have seen that object-oriented programming (OOP) helps organizing and maintaining large software systems.
Rotation of a rigid object rotating around a fixed axis. Axis of Rotation Consider the rotating object below.
OO in Context Lecture 13: Dolores Zage. Confused about OO Not alone, there is much confusion about OO many programs are claimed to be OO but are not really.
Object-Oriented Programming (OOP) Lecture No. 4 Downloaded From:
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
CSC241 Object-Oriented Programming (OOP) Lecture No. 2.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
Object-Oriented Paradigm (OOP) Course Code: SE 101 Lecture No. 1.
Introduction to Object Oriented Programming Lecture-3.
Object-Oriented Programming (OOP) Lecture No. 1. Course Objective ► Objective of this course is to make students familiar with the concepts of object-oriented.
MAITRAYEE MUKERJI Object Oriented Programming in C++
 Class and Diagram  Representation of Class Name Attributes Operations  Visibility of Attributes and Operations.
Object-Oriented Programming (OOP) Lecture No. 4
Object Oriented Programming
Object-Oriented Programming Concepts
Sachin Malhotra Saurabh Choudhary
Programming in Java Sachin Malhotra, Chairperson, PGDM-IT, IMS Ghaziabad Saurabh Chaudhary, Dean, Academics, IMS Ghaziabad.
Object-Oriented Programming (OOP) Lecture No. 1
Object Oriented Concepts
Software Engineering Lecture 10.
Software Engineering System Modeling Extra examples Dr.Doaa Sami
Workshop for Programming And Systems Management Teachers
Object-Oriented Programming
Object Oriented Design & Analysis
Computational Thinking (How to think like a computer scientist)
Presentation transcript:

Object-Oriented Programming (OOP) Lecture No. 3

Abstraction ► Abstraction is a way to cope with complexity. ► Principle of abstraction: “Capture only those details about an object that are relevant to current perspective”

Example – Abstraction ► Attributes - Name- Employee ID - Student Roll No- Designation - Year of Study- Salary - CGPA- Age Ali is a PhD student and teaches BS students

Example – Abstraction Ali is a PhD student and teaches BS students ► behaviour - Study- DevelopExam - GiveExam- TakeExam - PlaySports- Eat - DeliverLecture- Walk

Example – Abstraction ► Attributes - Name- Employee ID - Student Roll No- Designation - Year of Study- Salary - CGPA- Age Student’s Perspective

Example – Abstraction Student’s Perspective ► behaviour - Study- DevelopExam - GiveExam- TakeExam - PlaySports- Eat - DeliverLecture- Walk

Example – Abstraction ► Attributes - Name- Employee ID - Student Roll No- Designation - Year of Study- Salary - CGPA- Age Teacher’s Perspective

Example – Abstraction Teacher’s Perspective ► behaviour - Study- DevelopExam - GiveExam- TakeExam - PlaySports- Eat - DeliverLecture- Walk

Example – Abstraction ► Ordinary Perspective A pet animal with  Four Legs  A Tail  Two Ears  Sharp Teeth ► Surgeon’s Perspective A being with  A Skeleton  Heart  Kidney  Stomach A cat can be viewed with different perspectives

Example – Abstraction Driver’s View Engineer’s View

Abstraction – Advantages ► Simplifies the model by hiding irrelevant details ► Abstraction provides the freedom to defer implementation decisions by avoiding commitment to details

Classes ► In an OO model, some of the objects exhibit identical characteristics (information structure and behaviour) ► We say that they belong to the same class

Example – Class ► Ali studies mathematics ► Anam studies physics ► Sohail studies chemistry ► Each one is a Student ► We say these objects are instances of the Student class

Example – Class ► Ahsan teaches mathematics ► Aamir teaches computer science ► Atif teaches physics ► Each one is a teacher ► We say these objects are instances of the Teacher class

Graphical Representation of Classes (Class Name) (attributes) (operations) (Class Name) Normal Form Suppressed Form

Example – Graphical Representation of Classes Circle center radius draw computeArea Normal Form Suppressed Form Circle

Example – Graphical Representation of Classes Person name age gender eat walk Normal Form Suppressed Form Person

Inheritance ► A child inherits characteristics of its parents ► Besides inherited characteristics, a child may have its own unique characteristics

Inheritance in Classes ► If a class B inherits from class A then it contains all the characteristics (information structure and behaviour) of class A ► The parent class is called base class and the child class is called derived class ► Besides inherited characteristics, derived class may have its own unique characteristics

Example – Inheritance Person Teacher Doctor Student

Example – Inheritance Shape Circle Triangle Line

Inheritance – “IS A” or “IS A KIND OF” Relationship ► Each derived class is a special kind of its base class

Example – “IS A” Relationship Person name age gender eat walk Teacher designation salary teach takeExam Student program studyYear study heldExam Doctor designation salary checkUp prescribe

Example – “IS A” Relationship Shape color coord draw rotate setColor Circle radius draw computeArea Line length draw Triangle angle draw computeArea

Inheritance – Advantages ► Reuse ► Less redundancy ► Increased maintainability

Reuse with Inheritance ► Main purpose of inheritance is reuse ► We can easily add new classes by inheriting from existing classes  Select an existing class closer to the desired functionality  Create a new class and inherit it from the selected class  Add to and/or modify the inherited functionality

Example Reuse Shape color coord draw rotate setColor Circle radius draw computeArea Line length draw Triangle angle draw computeArea

Example Reuse Person name age gender eat walk Teacher designation salary teach takeExam Student program studyYear study heldExam Doctor designation salary checkUp prescribe

Example Reuse Person name age gender eat walk Teacher designation salary teach takeExam Student program studyYear study heldExam Doctor designation salary checkUp prescribe