Object-Oriented Programming (OOP) Lecture No. 5 Downloaded From: www.bsit.zxq.net.

Slides:



Advertisements
Similar presentations
UML an overview.
Advertisements

OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
Downloaded From:  We may want to reuse characteristics of more than one parent class Downloaded From:
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Chapter 14 (Web): Object-Oriented Data Modeling
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Chapter 2: Entity-Relationship Model (Continued)
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Chapter 14: Object-Oriented Data Modeling
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
01 November 2007Kaiser: COMS W4156 Fall COMS W4156: Advanced Software Engineering Prof. Gail Kaiser
COMS W4156: Advanced Software Engineering
OBJECT ORIENTED PROGRAMMING LECTURE 12 Instructor: Rashi Garg Coordinator: Gaurav Saxena.
Entities and Attributes
Lawrence ChungCS6359.0T1: Module 41 Module 4: Relationships.
CSC241 Object-Oriented Programming (OOP) Lecture No. 19.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part V: Design The Design Workflow Design Classes Refining Analysis Relationships.
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.
Association Class Generalization/Specialization Whole-Part Page More Associations 1.
Object-Oriented Programming (OOP) Lecture No. 5. Multiple Inheritance ► We may want to reuse characteristics of more than one parent class.
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
7-1 © Prentice Hall, 2007 Chapter 7: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
7-1 © Prentice Hall, 2007 Week 5: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
CS212: Object Oriented Analysis and Design Lecture 13: Relationship between Classes.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
CSC241 Object-Oriented Programming (OOP) Lecture No. 3.
Lecture 1: UML Class Diagram September 12, UML Class Diagrams2 What is a Class Diagram? A class diagram describes the types of objects in the system.
Class Diagram Classes are the most important building block of any object-oriented system. A class is a description of a set of objects that share the.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
CSCI-383 Object-Oriented Programming & Design Lecture 10.
1 Software Engineering Dr. K. T. Tsang Lecture 5 Class modeling
Object-Oriented Programming (OOP) Lecture No. 3 Downloaded From:
Database Design – Lecture 12 Object Oriented Database Design cont’d.
Chapter 12 Object-oriented design for more than one class.
Data Modeling Using the Entity-Relationship (ER) Data Model.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Association / Aggregation / Composition and inheritance
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Object-Oriented Programming (OOP) Lecture No. 4 Downloaded From:
1 CSC241: Object Oriented Programming Lecture No 17.
CLASS DIAGRAMS A classy approach to objects. The Basic Class Diagram  Class Name  Attributes (- indicates private each would have properties or accessor/mutator.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
 To explain why the context of a system should be modelled as part of the RE process  To describe behavioural modelling, data modelling and object modelling.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
Object-Oriented Paradigm (OOP) Course Code: SE 101 Lecture No. 1.
Object-Oriented Programming (OOP) Lecture No. 1. Course Objective ► Objective of this course is to make students familiar with the concepts of object-oriented.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Object Oriented Programming
Object-Oriented Modeling
OBJECT ORIENTED CONCEPT
OBJECT RELATIONSHIPS, ATTRIBUTES, AND METHODS
Software Engineering Lecture #11.
UML Class Diagram.
Systems Analysis – ITEC 3155 Modeling System Requirements – Part 2
Object-Oriented Programming (OOP) Lecture No. 5
Object Oriented Analysis and Design
Presentation transcript:

Object-Oriented Programming (OOP) Lecture No. 5 Downloaded From:

Multiple Inheritance ► We may want to reuse characteristics of more than one parent class Downloaded From:

Example – Multiple Inheritance Mermaid Downloaded From:

Example – Multiple Inheritance Mermaid WomanFish Downloaded From:

Example – Multiple Inheritance Amphibious Vehicle Downloaded From:

Example – Multiple Inheritance Amphibious Vehicle Land VehicleWater Vehicle Vehicle CarBoat Downloaded From:

Problems with Multiple Inheritance ► Increased complexity ► Reduced understanding ► Duplicate features Downloaded From:

Problem – Duplicate Features Mermaid WomanFish eat … eat … ► Which eat operation Mermaid inherits? Downloaded From:

Solution – Override the Common Feature Mermaid WomanFish eat … eat … eat … Invoke eat operation of desired class Downloaded From:

Problem – Duplicate Features (Diamond Problem) ► Which changeGear operation Amphibious Vehicle inherits? Amphibious Vehicle Land VehicleWater Vehicle Vehicle CarBoat changeGear Downloaded From:

Solution to Diamond Problem ► Some languages disallow diamond hierarchy ► Others provide mechanism to ignore characteristics from one side Downloaded From:

Association ► Objects in an object model interact with each other ► Usually an object provides services to several other objects ► An object keeps associations with other objects to delegate tasks Downloaded From:

Kinds of Association ► Class Association  Inheritance ► Object Association  Simple Association  Composition  Aggregation Downloaded From:

Simple Association ► Is the weakest link between objects ► Is a reference by which one object can interact with some other object ► Is simply called as “association” Downloaded From:

Kinds of Simple Association ► w.r.t navigation  One-way Association  Two-way Association ► w.r.t number of objects  Binary Association  Ternary Association  N-ary Association Downloaded From:

One-way Association ► We can navigate along a single direction only ► Denoted by an arrow towards the server object Downloaded From:

Example – Association ► Ali lives in a House AliHouse lives-in 1 1 Downloaded From:

Example – Association ► Ali drives his Car AliCar drives * 1 Downloaded From:

Two-way Association ► We can navigate in both directions ► Denoted by a line between the associated objects Downloaded From:

Example – Two-way Association EmployeeCompany works-for 1 * ► Employee works for company ► Company employs employees Downloaded From:

Example – Two-way Association YasirAli friend 1 1 ► Yasir is a friend of Ali ► Ali is a friend of Yasir Downloaded From:

Binary Association ► Associates objects of exactly two classes ► Denoted by a line, or an arrow between the associated objects Downloaded From:

Example – Binary Association ► Association “works-for” associates objects of exactly two classes EmployeeCompany works-for 1 * Downloaded From:

Example – Binary Association ► Association “drives” associates objects of exactly two classes AliCar drives * 1 Downloaded From:

Ternary Association ► Associates objects of exactly three classes ► Denoted by a diamond with lines connected to associated objects Downloaded From:

Example – Ternary Association ► Objects of exactly three classes are associated StudentTeacher Course 1 * * Downloaded From:

Example – Ternary Association ProjectLanguage Person ► Objects of exactly three classes are associated * 1 * Downloaded From:

N-ary Association ► An association between 3 or more classes ► Practical examples are very rare Downloaded From:

Composition ► An object may be composed of other smaller objects ► The relationship between the “part” objects and the “whole” object is known as Composition ► Composition is represented by a line with a filled-diamond head towards the composer object Downloaded From:

Example – Composition of Ali Ali Body Arm Head Leg Downloaded From:

Example – Composition of Chair Chair SeatArm Back Leg Downloaded From:

Composition is Stronger ► Composition is a stronger relationship, because  Composed object becomes a part of the composer  Composed object can’t exist independently Downloaded From:

Example – Composition is Stronger ► Ali is made up of different body parts ► They can’t exist independent of Ali Downloaded From:

Example – Composition is Stronger ► Chair’s body is made up of different parts ► They can’t exist independently Downloaded From:

Aggregation ► An object may contain a collection (aggregate) of other objects ► The relationship between the container and the contained object is called aggregation ► Aggregation is represented by a line with unfilled-diamond head towards the container Downloaded From:

Example – Aggregation Room Cupboard Bed ChairTable * Downloaded From:

Example – Aggregation GardenPlant * Downloaded From:

Aggregation is Weaker ► Aggregation is weaker relationship, because  Aggregate object is not a part of the container  Aggregate object can exist independently Downloaded From:

Example – Aggregation is Weaker ► Furniture is not an intrinsic part of room ► Furniture can be shifted to another room, and so can exist independent of a particular room Downloaded From:

Example – Aggregation is Weaker ► A plant is not an intrinsic part of a garden ► It can be planted in some other garden, and so can exist independent of a particular garden Downloaded From: