May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.

Slides:



Advertisements
Similar presentations
Object-Oriented Analysis and Design: Object Modeling – Class Diagrams
Advertisements

Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
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.
Stéphane Ducasse«ChapterNr».1 Arthur Riel Design Heuristics from Object-Oriented Design Heuristics by Arthur Riel Read the Heuristics… –Find reasons why.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4- 1.
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
L4-S1Relationships 2003 SJSU -- CmpE Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
The Relationships Between Classes & Objects Presented by Tim Sweeney.
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department.
MORE ON CLASS MODELS Lecture Outline Aggregation and composition Roles Navigability Qualified association Derived association Constraints Association.
Object Oriented Databases - Overview
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
L6-1-S1Design Heuristics - 1 © M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department,
Distribution of Marks Internal Sessional Evaluation Assignments – 10 Quizzes – 10 Class Participation Attendence – 5 Mid – Term Test – 25 External Evaluation.
Unified Modeling Language
Object-Oriented Analysis and Design
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Entities and Attributes
SJSU – CmpE Fall 2002 Enterprise & Application Frameworks Dr. M.E. Fayad, Professor Computer Engineering Department – RM# College of Engineering San José.
Fall, 2002 SJSU -- CMPE Enterprise & Application Frameworks Dr. M.E. Fayad, Professor Computer Engineering Department – RM# College of Engineering San.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 8 Slide 1 Chapter 9 Structuring System Data Requirements.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology Khan younis.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Association Class Generalization/Specialization Whole-Part Page More Associations 1.
S.Ducasse Stéphane Ducasse 1 Design Heuristics.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
L4-S1 Modeling Concepts 2003 SJSU -- CMPE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I.
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.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
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.
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
 Week08.  Review Schedule Weeks 8-14  This week o Review last class o Introduce Class Diagrams o ICE-03 Sheridan SYST Engineering Quality Systems.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
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.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Lecture 3 A short revision of ER and EER modelling See R. Elmasri, S.B. Navathe. Fundamentals of Database Systems (third edition) Addison-wesley. Chapter.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
Object-Oriented Modeling
Business System Development
Lec 3: Object-Oriented Data Modeling
Chapter 20 Object-Oriented Analysis and Design
Software Architectures
Enterprise & Application Frameworks
Object Oriented System Design Class Diagrams
Presentation transcript:

May-June 2001 ISISTAN Research Institute – Tandil, Argentina Software Design Methodologies: UML in Action Dr. Mohamed Fayad, J.D. Edwards Professor Department of Computer Science & Engineering University of Nebraska, Lincoln Ferguson Hall, P.O. Box Lincoln, NE

L10-S2OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 2 Lesson 10: Object-Oriented Concepts -1

L10-S3OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Lesson Objectives 3 Overview of Previous Lecture Understand some OO Concepts Discuss Advanced Issues about Attributes Understand UML- Inheritance Explore Multiple Inheritance The Uses & Containment Relationships

L10-S4OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 4 Modeling Concepts  Logical Forms  Structure  Abstraction  Concepts  Objects  Classes  Roles  Actors

L10-S5OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 5 Logical Forms  The same substance often take several forms.  ice, steam, water, snow, frost, fog are different forms of H 2 O  Some substances can be transformed from one form to another.  Not all of our studies are of material substances.  Speech, Writing, Geometry, Physics, etc.  But each area of human study acknowledges the existence of “good form”.  “Form” is thus equated with the existence of a pattern/order/consistency/regularity

L10-S6OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 6 Structure  “Structure” is the way a thing/construct/form us built up from its parts.  Changing the structure’s content can lead to new forms.  Musical notes, part of a house, etc.  A given content may exist in several different forms.  But each area of human study acknowledges the existence of “good form”.  Conversely, a form may also appear in several different contents  In fashion, dresses can be made from different materials.

L10-S7OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 7 Abstraction  “Abstraction” is the consideration of a form apart from its contents. Examples:  “roundness” is a property of a golf ball, a snow ball, a baseball, etc.  “hardness’ is a property of diamond, wood, steel, etc.  Abstraction can be improved upon by practice and study.  Abstract forms are discovered, and named, in the investigation of analogous forms.  A song ==> piano, guitar, etc.  A sphere ==> gold, steel, etc.  We teach abstraction by presenting a set of different things (physical or conceptual) and pointing out the common features that called formal properties.  formal properties are those properties that allow us to express the form of a thing.

L10-S8OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 8 Concept  “A concept” is an abstract form or an abstraction.  There is a set corresponding to each concept.  “The dress is white” means the dress is a member of the set of white things.  These sets need not to be disjoint (i.e., the same member may appear in several sets.  The white dress is short and charming.  These set are called classes or categories.  Concepts are formal properties we use to describe things.  The primitive notions of a factual scientific theory are its concepts  Biology ==> cells, bacteria, virus, animal, plant, etc.  Adjectives & adverbs usually are the names of concepts in English

L10-S9OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 9 Roles  A “role” is the part of a person or thing plays in a specific situation, operation, etc..  Many different object can play the same role.  Many roles can be played by the same object.  The white dress is short and charming.  A description of a role involves descriptions of:  Activities to be performed  Sequences or processes  Commands to be given and received  Roles are, therefore, abstractions (i.e., abstract forms or concepts).  In fact, roles are abstract temporal forms (i.e., a certain behavior at relative points in time).

L10-S10OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 10 Actors  Roles are defined independently of the things used to play that role.  Conversely, Actors are classes that are capable of playing different roles.  They are often classes of physical things.  Man, Woman, Car, etc.  They are often capable of playing different roles in the same time  Woman ==> Doctor, Mother, Pilot  They often take-on and lose roles over time

L10-S11OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad  Attributes are simply the information associated with the object.  The data type used to hold the attributes is often a fundamental type, such as int or char.  Sometimes the attribute can be a non-fundamental type, such as String type and Address type.  Avoid using attributes which might be better implemented as an association to a new class. 25 Attribut es

L10-S12OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad x 12 More on Attributes TV String model String serialNum String manName For example: Why? Using an association to a Manufacturer class, the name and address of each manufacturer will be stored in one place rather than in each of the TV objects made by that manufacturer. TV String model String serialNum Manufacturer String name Address address productmanu- facturer Using Attributes Using Association

L10-S13OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 13 More on Attributes Employee String name float salary long clearanceNum If attributes only make sense in some instances of a given class but not in others. It will make sense to split the single class into two classes or more. Employee String name float salary ClearedEmployee long clearanceNum openVault() Split into two classes Not all employees have clearances inheritance

L10-S14OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad When a relationship exists between classes such that lower-level classes (called subclasses) share certain attributes and behaviors which can be defined once in a higher-level class (called superclasses). Subclasses inherit properties (attributes and behaviors) of its superclass and then adds its own unique properties and modifies any inherited properties. This is called Generalization or Inheritance. 14 Inheritance

L10-S15OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 15 More on Inheritance Window size icon paintWindow bitmaps textWindow contents

L10-S16OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Generalization, Specialization (1) Related terms: inheritance Definition: –Inheritance is a programming language concept; an implementation mechanism for the relationship between superclasses and subclasses by means of which attributes and operations of a superclass also become accessible to its subclasses. –Generalization (or specialization) is a taxonomic relationship between a general and a special element (or vice versa), where the special element adds properties to the general one and behaves in a way that is compatible with it. 16

L10-S17OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Generalization, Specialization (2) Notation: –The inheritance relation is represented by means of a large empty arrow pointing from the subclass to the superclass. Superclass Subclass 17

L10-S18OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Generalization, Specialization (3) Generalization relations can be provided with the following predefined constraints: –overlapping –disjoint –complete –incomplete 18 Superclass Subclass1Subclass2 {incomplete}

L10-S19OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Generalization, Specialization (4) Example: GeomFigure {abstract} x: Integer y: Integer visible: Boolean display() {abstract} Remove() {abstract} moveTo(pX, pY) Triangle a {c-b<a<b+c} b {a-c<b<a+c} c {a-b<c<a+b} setSides(pA,pB,pC) display() remove() Rectangle a {a>0} b {b>0} setSides(pA, pB) display() remove() Circle radius {radius >0) setRadius(pR) display() remove() 19

L10-S20OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Multiple Inheritance In multiple inheritance, a class can have more than one superclass. Animal Fish Aquatic Trout Mammal Dolphin Terrestrial Pig Habitat 20

L10-S21OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Multiple Inheritance Example: Vehicle name manufacuturer Windpowered Vehicle minWindForce maxWindForce Motor Vehicle fuelType power Water Vehicle draught displacement surfaceOfSails numOfSails SailingBoat KindOfPower{Overlapping} 21 LocomotionMedium

L10-S22OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Multiple Inheritance Overlapping Versus Disjoint overlappingSailingboat name manufacturer draught displacement surfaceOfSails numOfSails disjointSailingBoat waterVehicle:name windpoweredVehicle.name waterVehicle:manufacturer windpoweredVehicle.manufacturer draught displacement surfaceOfSails numOfSails 22

L10-S23OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad The uses relationship (object-based) The containment relationship (object-based) The inheritance relationship (class-based) The association relationship (object-based) The term “object-based vs. class-based” denotes whether or not all objects of a class have to obey the relationship. Each relationship has its own characteristics and can be dangerous when used in the wrong area of design. Each relationship has its own heuristics governing its correct use. 23 The Relationships between Classes & objects - Heuristics

L10-S24OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Most common Definition: if an object of one class sends a message to an object of another class, the first class is said to have a uses relationship with the second class. Example: 24 The Uses Relationship Name: Bob Jones Age: 30 Eyes: Blue Hair: Brown Height: 5’ 10” Weight: 170 APerson Hour: 6 Minute: 23 AlarmHour: 10 AlarmMinute: 30 AlarmStatus: On AnAlarmClock Set_time (“10:30”) A person using an alarm clock

L10-S25OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Heuristic 1: Minimize the number of classes with which another class collaborates. 25 Heuristics for the Uses Relationship Restaurant Patron Melon Steak Pie cost() Restaurant Patron Steak Melon Pie cost() Meal

L10-S26OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Heuristic 2: Minimize the number of messages send between a class and its collaborator. Heuristic 3: Minimize the amount of collaboration between a class and its collaborator, that is, the number of different messages sent. Heuristic 4: Minimize fanout in a class, that is, the product of the number of messages defined by the class and the messages they send. 26 Heuristics for the Uses Relationship

L10-S27OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Heuristic 1: If a class contains objects of another class, then the containing class should be sending messages to the contained objects, that is, the containment relationship should always imply a uses relationship. Heuristic 2: Most of the methods defined on a class should be using most of the data members most of the time. Heuristic 3: Classes should not contain more objects than a developer can fit in his or her short-term memory. A favorite value for this number is six. Heuristic 4: Distribute system intelligence vertically down narrow and deep containment hierarchies. (?) 27 Heuristics for the Containment Relationship

L10-S28OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Semantic constraint is an application-specific constraint imposed on an OO relationship restricting its scope or behavior, most often associated with the containment relationship. Heuristic 5: When implementing semantic constraints, it is best to implement them in terms of class definition. Often this will lead to a proliferation of classes, in which case the constraint must be implemented in the behavior of the class – usually, but not necessarily, in the constructor. 28 Semantic Constraints Between Classes (1)

L10-S29OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Heuristic 6: When implementing semantic constraints in the constructor of a class, place the constraint test in the constructor as far down a containment hierarchy as the domain allows. Heuristic 7: The semantic information on which a constraint is based is best placed in a central, third party object when that information is volatile. Heuristic 8: The semantic information on which a constraint is based is best decentralized among the classes involved in the constraint when that information is stable. 29 Semantic Constraints Between Classes (2)

L10-S30OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Heuristic 9: A class must know what is contains, but it should not know who contains it. Heuristic 10: Objects that share lexical scope – those contained in the same containing class – should not have uses relationships between them. 30 More Containment Heuristics

L10-S31OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 31 Objects Sharing Lexical Scope Problem (1) ATM CardReaderDisplay Keypad display_pin() get_pin() Example of objects sharing lexical scope and using each other

L10-S32OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad 32 Objects Sharing Lexical Scope Problem (2) ATM CardReader Display Keypad display_pin() get_pin() A better solution to the objects sharing lexical scope problem have_a-card()

L10-S33OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Class-based relationship: an OO relationship between two classes in which all objects of the classes involved obey the relationship. Container class: a class whose main purpose is the storage of other objects. Often implemented as a homogeneous-looking list of heterogeneous objects, namely, a polymorphic list. Containment by value: A containment relationship in which the contained object is directly linked to the containing class, that is, the objects involved in the relationship are born and die together. Containment by reference: A containment relationship in which the contained object is indirectly linked to the containing class, usually via a pointer or referential attribute. 33 Summary

L10-S34OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Define uses and containment relationships What is semantic constraint? What do you think “multiple inheritance” means? Define Polymorphism with examples What do we mean by saying “Model/View/Controller”? 34 Discussion Questions

L10-S35OO Concepts -1 May-June 2001 ISISTAN Research Institute – Tandil, Argentina -- M.E. Fayad Define: –Interactions vs. relationships –Inheritance vs. aggregation –Define: association, attributed association, recursive associations, –Explain: association constraints, qualified associations, composition –Discuss the inheritance relationship heuristics 35 Questions for the Next Lecture