© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML Class Diagrams.

Slides:



Advertisements
Similar presentations
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 9 Object, Package, Component and Deployment Diagrams (Based on Fowler, 2004,
Advertisements

ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Modeling Notations.
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.
UML – Class Diagrams.
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
MORE ON CLASS MODELS Lecture Outline Aggregation and composition Roles Navigability Qualified association Derived association Constraints Association.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 Class and Object Diagrams PRACTICAL OBJECT-ORIENTED DESIGN WITH.
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Unified Modeling Language
The Unified Modeling Language (UML) Class Diagrams.
Object-Oriented Analysis and Design
COMS W4156: Advanced Software Engineering
UML Diagrams Computer Science I.
Lawrence ChungCS6359.0T1: Module 41 Module 4: Relationships.
Software Construction Lecture 5 Class Diagrams. Agenda 2  Topics:  Examples of class diagrams  Navigation, visibility, named associations, and multiplicity.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
UML Class Diagrams and Caché CAMTA Meeting – 1 st December 2011 John Murray Senior Product Engineer.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Visibility, Accessibility, and Information Hiding.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
Chapter 16 Applying UML and Patterns Craig Larman
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
1 Advanced Software Architecture Muhammad Bilal Bashir PhD Scholar (Computer Science) Mohammad Ali Jinnah University.
UML Diagrams: The Static Model Class Diagrams. The Static Model Define the static structure of the logical model Represent classes, class hierarchies.
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.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
An Introduction to the Unified Modeling Language
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis and Design Class and Object Diagrams.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
1 Class Diagrams. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are for visualizing, specifying and documenting.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component.
Chapter 3 Class Diagrams. 2 Outline Class Basics Class Basics Classes Classes Association Association Multiplicity Multiplicity Inheritance Inheritance.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
UML Part 1: Class Diagrams. Introduction UML stands for Unified Modeling Language. It represents a unification of the concepts and notations presented.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Object-Orientated Analysis, Design and Programming
UML Diagrams: Class Diagrams The Static Analysis Model
Structural Modeling.
Visit for more Learning Resources
Course Outcomes of Object Oriented Modeling Design (17630,C604)
COMPONENT & DEPLOYMENT DIAGRAMS
Class Diagrams.
Class Diagram Details CS 124.
UML Diagrams: The Static Model Class Diagrams
Object Oriented Analysis and Design
Software Engineering Lecture #11.
Class Diagrams.
Object Oriented System Design Class Diagrams
The generalization of class
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
From Class Diagram to Contract Diagram
Presentation transcript:

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML Class Diagrams

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Objectives  To present the portions of the UML class diagram notation not already covered  To present examples to illustrate the use of the notation  To present heuristics for using the notation well

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 3 Topics  Generalization  Abstract and concrete operations and classes  Interfaces  Feature visibility  Class and instance variables and operations  Aggregation and composition  Association classes and qualifiers  Other association adornments  More class diagram heuristics

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4 Generalization  Generalization is the UML relation that holds between one model element (the parent) and another (the child) when the child is a special type of the parent. Represented by a hollow rectangle and lines Rectangle attaches to the parent and lines to the children  Generalization is used in UML class diagrams to model inheritance.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5 Generalization Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6 Generalization versus Association  Generalization is a relation between classes.  Associations represent relations on sets of class instances designated by the associated classes.  Generalization is not a kind of association. They Never have multiplicities, Never have rolenames, Never have names (they already have a name: generalization).

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7 Abstract Operations and Classes  An abstract operation is an operation without a body; a concrete operation has a body.  An abstract class is a class that cannot be instantiated; a concrete class can be instantiated.  A class Must be abstract if it has an abstract operation; May be abstract even if it has no abstract operations.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 8 Using and Representing Abstract Classes and Operations  Abstract classes force their subclasses to implement certain operations.  Abstract classes are represented in UML by Italicizing their names, Stereotyping them «abstract» or Giving them an {abstract} property.  Abstract operations are represented in UML by Italicizing their specification or Giving them an {abstract} property.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 9 Abstract Class and Operation Examples

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10 Interfaces A UML interface is named collection of public attributes and abstract operations. Provided interfaces—realized by a class or component and represented by  A ball (lollipop) symbol or  A stereotyped class icon with a realization connector Required interfaces—needed by a class or component and represented by  A socket symbol or  A dependency arrow to a ball symbol or  A dependency arrow to a stereotyped class icon

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11 Provided Interface Notations

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 12 Required Interface Notations

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 13 Module Assembly Notations

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14 UML Feature Visibility  Public—Visible anywhere that the class in which it appears is visible; denoted by +.  Package—Visible anywhere in the package containing the class in which it appears; denoted by ~.  Protected—Visible in the class in which it appears and all its sub-classes; denoted by #.  Private—Visible only in the class in which it appears; denoted by -.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 15 Feature Visibility Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 16 Class and Instance Variables and Operations  An instance variable is an attribute whose value is stored by each instance of a class.  A class variable is an attribute whose value is stored only once and shared by all instances.  An instance operation must be called through an instance.  A class operation may be called through the class.  In UML class variables and operations are called static. Indicated by underlining an attribute’s or operation’s specification

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17 Attribute and Operation Specification Examples

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18 Aggregation and Composition  The aggregation association represents the part-whole relation between classes. Denoted by a solid diamond and lines Diamond attaches to the aggregate (whole) while lines attach to the parts May have all association adornments  The composition association is an aggregation association in which each part can be related to only one whole at a time. Denoted by a hollow diamond and lines

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 19 Aggregation and Composition Examples

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20 Problems with Aggregation  Often abused Must be transitive:  (x)(y)(z)((Rxy Ryz)  Rxz) Often used for collection membership, which is not transitive  Aggregation, composition, and collection membership can be represented by plain associations.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 21 Association Classes  An association class represents a relation on instances of the classes is connects, and it holds data and behavior. Association class connector is a dashed line Connects class with an association line  There can be only one instance of an association class for each pair of instances of the associated classes.  If more instances are need, interpose a new class (a reified association).

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 22 Association Class Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 23 Association Qualifiers An association qualifier is one or more association attributes that, together with instances of the qualified class, pick out instances of an associated target class. Represented by a box with association attributes and a line Attributes have standard specifications except that no initial values are allowed Box is attached to the qualified class Line runs to the target class Line can have association adornments

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 24 Association Qualifier Examples

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 25 Rolename Visibility  Associations are often implemented using references. Rolename may be a reference attribute name  Rolenames may have visibility modifiers (+, #, ~, -).  Rolename visibility modifiers may be suppressed.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 26 Association Navigability An association between classes A and B is navigable from A to B if an instance of A can access an instance of B; otherwise it is non- navigable. Navigability is denoted by adding an arrowhead to the association line in the navigation direction Non-navigability is denoted by placing an x on the association line in the navigation direction Navigability markers can be suppressed, so no markers means the diagram is silent on navigability

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 27 Rolename Visibility and Navigability Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 28 Class Diagram Heuristics 1  Never place a name, rolenames, or multiplicities on a generalization connector.  Use the «abstract» stereotype and {abstract} property to indicate abstract classes and operations when drawing diagrams by hand; use italics when drawing diagrams on the computer.  Use the interface ball and socket symbols to abstract interface details and a stereotyped class symbol to show details.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 29 Class Diagram Heuristics 2  Don’t italicize interface or operation names.  Show provided interfaces with the interface ball symbol or the stereotyped class symbol and a realization connector.  Show required interfaces with the interface socket symbol or dependency arrows to stereotyped class symbols or interface ball symbols.  Avoid aggregation and composition.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 30 Class Diagram Heuristics 3  If aggregation or composition is used, check that the represented relation is transitive.  Use association classes when only a single association class instance is associated with each pair of instances of the associated classes; otherwise use a reified association.  Determine multiplicities involving a qualifier by considering qualified class instances and particular combinations of qualifier attribute values.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 31 Summary UML class diagrams have great expressive power: they are able to show Generalization Abstract operations and classes Class and instance variables and operations Interfaces and interface assemblies Aggregation and composition associations Association classes and quantifiers Feature and rolename visibility Navigability