Class diagram Used for describing structure and behaviour in the use cases Provide a conceptual model of the system in terms of entities and their relationships.

Slides:



Advertisements
Similar presentations
Database Design: ER Modelling (Continued)
Advertisements

Object-oriented modeling Class/Object Diagrams
Analysis Modeling.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
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.
Introduction to UML. Acknowledgements Slides material are taken from different sources including: Slides material are taken from different sources including:
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
The Unified Modeling Language
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
PRJ566: PROJECT PLANNING AND MANAGEMENT Class Diagrams.
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Introduction to UML Prashanth Aedunuthula Fall, 2004.
Introduction to UML Shiyuan Jin Fall, 2006.
Page 1 What is the UML? UML stands for Unified Modeling Language The UML combines the best of the best from – Data Modeling concepts (Entity Relationship.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.
Lecture 7 Object Oriented Design. Outline  What is UML and why we use UML?  How to use UML diagrams to design software system?  What UML Modeling tools.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 - Domain Classes.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
Lab 04.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
NI ©UNITEN 2000/01 1 Faculty of Applied Engineering and Urban Planning Software Engineering Department Class Diagram Faculty of Information system Technology.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
Class Diagrams Identifying and representing Classes Object Web, Bapayya Choudhary Maganti.
EEL5881 Software Engineering I UML Lecture Yi Luo.
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.
An Introduction to the Unified Modeling Language
5 Systems Analysis and Design in a Changing World, Fifth Edition.
What is a Structural Model?
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.
Object Oriented Analysis and Design Class and Object Diagrams.
Database Design – Lecture 4 Conceptual Data Modeling.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Lecture 14 22/10/15. The Object-Oriented Analysis and Design  Process of progressively developing representation of a system component (or object) through.
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.
Introduction to UML Created By: Ajay Bahoriya. Acknowledgements Slides material are taken from different sources including: Slides material are taken.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 10 Structuring.
Lecture 13. Unified Modeling Language (UML) The first applications you wrote in CS201 were easy to think out and code with no intermediate steps. Lab.
Introduction to UML Mohammad Zubair Ahmad Summer 2007.
 Class and Diagram  Representation of Class Name Attributes Operations  Visibility of Attributes and Operations.
Entity-Relationship Model
UML Diagrams: Class Diagrams The Static Analysis Model
UML-Class Diagrams. UML-Class Diagrams Order placement problem A Company has two types of customers, corporate customers and personal customers. All.
Chapter 5: Structural Modeling
Class diagram Description
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
UML Unified Modelling Language
Introduction to UML Introduction to UML Shiyuan Jin September,23,2002
Object Oriented Analysis and Design
Software Engineering Lecture #11.
UML Class Diagram.
Class Diagrams Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application.
Class Diagram.
CSE470 Software Engineering UML Lecture.  UML resource page
Object Oriented System Design Class Diagrams
Information System Design
Chapter 11: Class Diagram
Lecture 10 Structuring System Requirements: Conceptual Data Modeling
Presentation transcript:

Class diagram Used for describing structure and behaviour in the use cases Provide a conceptual model of the system in terms of entities and their relationships Used for requirement capture, end- user interaction Detailed class diagrams are used for developers

Class representation Each class is represented by a rectangle subdivided into three compartments Name Attributes Operations Modifiers are used to indicate visibility of attributes and operations. ‘+’ is used to denote Public visibility (everyone) ‘#’ is used to denote Protected visibility (friends and derived) ‘-’ is used to denote Private visibility (no one) By default, attributes are hidden and operations are visible.

An example of Class

Finding Classes Classes are identified by examining the nouns and noun phrases in scenarios Nouns found may be: Objects Description of the state of an object External entities and/or actors None of the above

Finding Classes … Beware that: Several terms may refer to the same object One term may refer to more than one object Natural language is very ambiguous Therefore The list of nouns must be filtered.

Operation A operation is a service that can be requested from an object to effect behaviour. List of operations is dependent on the problem domain. Lecturer from Registrar’s perspective Lecturer from leave clerk’s perspective

Operation … Operation should be named to indicate their outcome. CalculateBalance() Poorly named getBalance() Better named

Operation … Operation should be named from the perspective of the supplier, not the client. E.g. In a pertrol station, petrol is received from the pump. Dispense() Good name receiveGas() Bad name

Operation … Operation has signature. The operation signature consists of Optional argument list Return type During analysis it is NOT mandatory to fill in the operation signature. It may be delayed until design.

Attributes An attribute is a data definition held by instances of a class. Attributes do not have behaviour Attribute names are simple nouns or noun phrases Each attribute should have a clear, concise definition, e.g. for the Student class Good attributes are name, major. Bad attribute e.g. is selectedCourse (this is a relationship!)

Attributes … Similar to operations, list of attributes is dependent on the problem domain. Banker’s perspective Name, address, dateOfBirth, account no. Doctor’s perspective Name, address, dateOfBirth, height, weight

Attributes … A ‘derived attributes’ is an attribute whose value may be calculated based on the value of other attribute(s). Used when there is not enough time to recalculate the value every time needed Trades off runtime performance versus memory required.

Attributes … Each attribute has Data type Optional initial value During analysis, it is NOT mandatory to complete the attribute definition, this information may be delayed until design.

Attributes … How are attributes discovered? Many attributes are discovered in the flow of events for the use cases Look for nouns that were not considered good candidate classes Others are discovered when the class definition is created Domain expertise can also provide good attributes

Class Relationships There are two kinds of Relationships Generalization (parent-child relationship) Association (student enrolls in course) Associations can be further classified as Aggregation Composition

Subtype2 Supertype Subtype1 Generalisation - Generalization expresses a parent/child relationship among related classes. - Used for abstracting details in several layers Regular Customer Loyalty Customer Example: Regular Customer Loyalty Customer or:

Generalisation

Association represents relationship between instances of classes Student enrolls in a course Courses have students Courses have exams etc. Association has two ends Names (e.g. enrolls) Multiplicity (e.g. One course can have many students) Navigability (unidirectional, bidirectional) Association

To clarify its meaning, an association may be named. The name is represented as a label placed along the association line, midway between the class notations. An association name is usually a verb or verb phrase. Association Name

Multiplicity is the number of instances of one class related to ONE instance of the other class. For each association, there are two multiplicity decisions to make; one for each end of the association. Association Multiplicity

Many * Exactly one 1 Zero or more0..* One or more1..* Zero or one 0..1 Specified range 2..4 Association Multiplicity …

Class Relationships

Other Relationships …

Association: Composition Class W Class P 1 Class P 2 Composition: expresses a relationship among instances of related classes. It is a specific kind of Whole-Part relationship. It expresses a relationship where an instance of the Whole-class has the responsibility to create and initialize instances of each Part-class. It may also be used to express a relationship where instances of the Part-classes have privileged access or visibility to certain attributes and/or behaviors defined by the Whole-class. Composition should also be used to express relationship where instances of the Whole-class have exclusive access to and control of instances of the Part-classes. Composition should be used to express a relationship where the behavior of Part instances is undefined without being related to an instance of the Whole. And, conversely, the behavior of the Whole is ill-defined or incomplete if one or more of the Part instances are undefined. Whole Class Part Classes Automobile Engine Transmission Example [From Dr. David A. Workman]

Association: Aggregation Class C Class E 1 Class E 2 AGGREGATION Aggregation: expresses a relationship among instances of related classes. It is a specific kind of Container- Containee relationship. It expresses a relationship where an instance of the Container-class has the responsibility to hold and maintain instances of each Containee-class that have been created outside the auspices of the Container-class. Aggregation should be used to express a more informal relationship than composition expresses. That is, it is an appropriate relationship where the Container and its Containees can be manipulated independently. Aggregation is appropriate when Container and Containees have no special access privileges to each other. Container Class Containee Classes Bag Apples Milk Example [From Dr. David A. Workman]

Aggregation vs. Composition CompositionComposition is really a strong form of aggregation components have only one owner components cannot exist independent of their owner components live or die with their owner e.g. Each car has an engine that can not be shared with other cars. Aggregations may form "part of" the aggregate, but may not be essential to it. They may also exist independent of the aggregate. e.g. Apples may exist independent of the bag.

Aggregation vs. Composition

Class Diagram Example

Class Diagram Example …

Summary Derivation of classes from use case description Class name Attributes Operations Refinement of list of classes Class relationships