Unified Modeling Language (UML) (Chapter 6). Unified Modeling Language  UML October 1994  Three Amigos  Grady Booch (Rational Software) [Booch]  James.

Slides:



Advertisements
Similar presentations
UML (cont.) “The Unified Modeling Language User Guide” by G. Booch, J. Rumbaugh and I. Jacobson ● Classes ● Relationships ● Class diagrams ● Examples.
Advertisements

UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Improved software quality through semantic descriptions (Skutt) Karlstad University Dept. of Computer Science UML introduction A short introduction.
Chapter 14 (Web): Object-Oriented Data Modeling
UML Class Diagram and Packages
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Unified Modeling Language (UML)
IMSE 11 - UML Class Diagrams
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Chapter 4: Object-Oriented Data Modeling
7M822 UML Class Diagrams advanced concepts 14 October 2010.
1 Object-Oriented Modeling Using UML CS 3331 Fall 2009.
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.
Unified Modeling Language
Object-Oriented Analysis and Design
COMS W4156: Advanced Software Engineering
UML Diagrams Computer Science I.
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
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.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
The Software Development Life Cycle: An Overview Presented by Maxwell Drew and Dan Kaiser Southwest State University Computer Science Program.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
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,
1 Class Diagrams: The Essentials. 2 Terms and Concepts A class is... The most important building block of any object-oriented system. A description of.
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.
UML for OOADStefan Kluth 1 2UML for OOAD 2.1What is UML? 2.2Classes in UML 2.3Relations in UML 2.4Static and Dynamic Design with UML.
16 August, 2007Information System Design IT60105, Autumn 2007 Information System Design IT60105 Lecture 7 Unified Modeling Language.
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.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
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
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
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.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
Chapter 3 Class Diagrams. 2 Outline Class Basics Class Basics Classes Classes Association Association Multiplicity Multiplicity Inheritance Inheritance.
1 Introduction to Classes. 2 Terms and Concepts A class is... –The most important building block of any object- oriented system. –A description of a set.
Modeling the Static Structure: Relationships ©SoftMoore ConsultingSlide 1.
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 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Chapter 3: Introducing the UML
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
Unified OO becomes commonly used in the late 1980s Various analysis and design methods The “three amigos” join forces in Rational Software Also include.
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.
Chapter 11 Inheritance © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured and Object-Oriented.
UML. Model An abstract representation of a system. Types of model 1.Use case model 2.Domain model 3.Analysis object model 4.Implementation model 5.Test.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
UML CSE 470 : Software Engineering. Unified Modeling Language UML is a modeling language to express and design documents, software –Particularly useful.
Modeling with UML – Class Diagrams
Unified Modeling Language (UML)
Unified Modeling Language
Class Diagrams.
Object-Oriented Modeling with UML
Introduction to Unified Modeling Language (UML)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Software Engineering Lecture #11.
Introduction to Unified Modeling Language (UML)
Unified Modelling Language
2 UML for OOAD 2.1 What is UML? 2.2 Classes in UML
Presentation transcript:

Unified Modeling Language (UML) (Chapter 6)

Unified Modeling Language  UML October 1994  Three Amigos  Grady Booch (Rational Software) [Booch]  James Rumbaugh (Objectory) [OMT]  Ivar Jacobson (General Electric) [OOSE]  Modeling language = mainly graphical notation that a modeling process uses to express designs

Why Model?  Simplification of reality  Better understand a complex system  visualization of the system  specification of structure or behavior of the system  implementational template  documentation  Facilitate finding the "best" solution  Communication tool

UML is a:  Language for visualization  graphical representation (static and dynamic)  Language for specifying  precise, unambiguous, and complete  Language for constructing  mapping from UML to OO programming language  Language for documenting  requirements, architecture, design, source code, plans, testing, prototypes, releases

Static Models in the UML (Class Diagrams)  Purpose  To depict classes and their attributes (data members), operations (methods) and relationships to other classes  Primary diagram structure  Class icon: rectangle divided into three compartments  Name, attributes, operations  Various types of connecting lines depict various types of relationships with other classes

The Class Icon ClassName Attribute : Type Operation() : returnType

Example: Simplest Class Diagram Circle radius : double center : Point setCenter(Point) setRadius(double) area() : double circumference() : double An Attribute is followed by a colon and its type An Operation is followed by a colon and its return type Parameters are types only or name : type This typing convention is used to create separation between the design and an implementational language.

Relationships between Classes  Where the power in a static diagram resides  Association - an object of one class is connected to objects of another class  Class roles  Aggregation - a "whole" object of one class is made up of "parts," which are other objects  Composition - stronger form of aggregation

Relationships between Classes (cont)  Generalization - an object of one class is a kind of object of another class  Inheritance  Dependency - an object of one class uses the services of (and therefore depends on) another object of a different class

Association  Represents a relationship between instances of two classes  Each association has two association ends, attached to one of the classes in the association  An end can be explicitly named with a label, or role name. Class AClass B role A role B

Roles  A role name becomes a data field name in the associated class definition  For example, role B becomes a data field name in the definition of class A  In the absence of a role name, the association end name is derived from the class attached to that end

Association and Navigability  An arrowhead on an association end indicates navigability; the target class is known about by the other class  Lack of arrowheads on an association indicates that the relationship is bidirectional  Additional notations indicate multiplicities

Multiplicities Class 1 exactly one Class * many (zero or more) Class 0..1 optional (zero or one) Class m..n numerically specified

Example of Associational Relationship Game playAgain : bool promptPlayAgain():bool newBoard() : Board Board state : long integer update(Move) display() board This diagram depicts one Game being associated with zero or one Boards. The arrowhead creates a directional relationship, meaning the Game knows about the Board, but not vice versa. The name on the arrow is called a role. The numbers are called multiplicities.

Classes can be Self-Associated data : someType setData(someType) getData() : someType next1 Linked_List The members of a linked-list may have differing lifetimes and their children may change. Therefore, the nodes of a linked-list have relatively weak relationships. 1

Composition: A Strong Relationship  ``Has-a'' relationship  When one class of object is composed of at least one instance of another class, we say that class "is made of" or "is composed of" (at least partially) the second class  An object can be part of only one other object  The multiplicity of the composing object is always 1

Composition and Lifetimes  The composition relationship implies that the life span of the second class is coincident with that of the first class:  The constructor and destructor of the second class are called in constructor and destructor of the first class

Diagram of Compositional Relationship Circle radius : double center : Point setCenter(Point) setRadius(double) area() : double circumference():double Point x : double y : double setX(double) setY(double) getX() : double getY() : double The blackened diamond represents composition. The arrowhead implies that the Point does not know about the Circle. The role relationship is to provide a center point for Circle objects. Note the unnecessary redundancy in the Circle attribute box, and the unnecessary multiplicity on the diamond. center 1 1

More on Composition  Arrowheads restrict the directionality of relationships, like in all classes of associations  If the arrowhead had been missing in the last diagram, the implementational implication would have been that #include "circle.H" is within point.H so arrowheads tend to be the norm

Implementation of Composition class Point{ public: void setX(double); void setY(double); double getX(void) const; double getY(void) const; private: double x; double y; }; Notice that Point knows nothing about Circles

Implementation of Composition (cont'd) class Circle{ public: void setCenter(const Point&); void setRadius(const double); double area(void) const; double circumference(void) const; private: double radius; Point center; }; Here it is obvious that the Point data member lives and dies with the Circle. The Point could be implemented using a pointer, in which case it would have to be deleted in the Circle destructor.

Another Composition Example SquarePoint 2uLeft lRight setCorners(Point,Point) area() : double class Square{ public: void setCorners(const Point&, const Point&); double area(void) const; private: Point uLeft; Point lRight; }; 1

Aggregation  Indicated with a non-blackened diamond  Weaker than composition regarding object lifetimes  Can be represented simply through multiplicities

Aggregation Example BinaryTree leftChild() : BinaryTree rightChild() : BinaryTree rChild lChild A binary tree would not be a tree, if it were not for its containing (aggregating) two of its own type. A node may contain zero to two children.

Example Structural Relationship Diagram ** 1..* Instructor SchoolDepartment StudentCourse 1 1..* * * 0..1 chairperson 0..1

Generalization Diagrams  Shows the "is-a" relationship between a general class of objects (superclass or parent) and their specializations (subclass, child or derived class)  Implies the child objects can be used in place of a parent, but not vice versa  Inherited attributes and/or operations are not repeated in the subclasses, unless they are polymorphic (virtual)

Generalization Diagrams (cont'd)  Abstract classes have names  Italic font  {Abstract} label next to name  Virtual operations  Italic font  Can also be labeled with {Abstract}

Example Generalization Diagram Queue maxSize: Integer front: Integer rear: Integer display(): void add(Item): void remove(): Item empty(): Boolean full(): Boolean FrontQueue Item * items 1

Example Multiple Inheritance Diagram InterestBearingInsurable Asset Bank AccountReal EstateSecurity CheckingSavingsStockBond

Dependency  Represents a "using" relationship  Implies a change in an object of one class may effect an object in another class which uses that object  The reverse is not necessarily true  The object depended on is not contained in the depending class object  Usually implemented as member function arguments

Dependency Diagram Board state : Integer updateBoard(m : Move) Move dir : Direction nextMove() : Move or Board state : Integer updateBoard() Move dir : Direction nextMove() : Move