250 likes | 384 Views
Chapter Two The UML – Unified Modeling Language. Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University. Outline. Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary.
E N D
Chapter TwoThe UML –Unified Modeling Language Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University
Outline • Overview • What is the UML? • Why use the UML? • The class diagram • Interaction Diagrams • Summary The Unified Modeling Language
Overview • A brief overview of the Unified Modeling Language (UML) • What the UML is and why to use it • Essential UML diagrams • The Class Diagram • The Interaction Diagram The Unified Modeling Language
Outline • Overview • What is the UML? • Why use the UML? • The class diagram • Interaction Diagrams • Summary The Unified Modeling Language
What is the UML? • A visual language to create models of programs • A drawing notation with semantics • A diagrammatic representation of the programs • Different diagrams for • Analysis • Design • Implementation (dissemination) The Unified Modeling Language
UML Diagrams • In the analysis phase • Use Case Diagrams • Entities interacting with the system • Function points • Activity Diagrams • Workflow of the problem domain • Looking at object interactions • Interaction Diagrams • How specific objects interact with each other • Sequence Diagram is the most popular The Unified Modeling Language
UML Diagrams • In the design phase • Class Diagrams • Detail the relationships between the classes • Looking at an object’s behaviors • State Diagrams • Detail the different states an object may be in • The transitions between these states • In the deployment phase • Deployment Diagrams • How different modules will be deployed The Unified Modeling Language
Outline • Overview • What is the UML? • Why use the UML? • The class diagram • Interaction Diagrams • Summary The Unified Modeling Language
Why Use the UML? • For communication • With yourself, team members and customers • For clarity • To determine if my understanding of the system is the same as others • For precision • A better way of describing object-oriented designs • Force the designer to think through his/her approach The Unified Modeling Language
Outline • Overview • What is the UML? • Why use the UML? • The class diagram • Interaction Diagrams • Summary The Unified Modeling Language
The Class Diagram • The most basic of UML diagram • Describe classes • Show the relationships between them • When one class is a “kind of” another class • is-a relationship • When there are associations between two classes • One class “contains” another class: the has-a relationship • Composition: the contained item is a part of the containing item • Aggregation: a collection of things that can exist on their own • One class “uses” another class The Unified Modeling Language
Class Information • Each rectangle represents a class • The name of the class • The data members of the class • The methods (functions) of the class • Notation for access • Public • Notated with a plus sign (+) • Protected • Notated with a pound sign (#) • Private • Notated with a minus sign (-) The Unified Modeling Language
Square Square +display() -length : double +display() Class Diagram – Its Three Variations • Whenever we refer to a class name, we will bold it as done here. Square The Unified Modeling Language
Shape Line Square Point Class Diagram – is-a relationship • Shape is italicized – meaning it is an abstract class The Unified Modeling Language
Aircraft Jet Helicopter Airport Class Diagram – has-a relationship • Aggregation ( an unfilled diamond ) • Airport has Aircraft • Aircraft is not part of Airport The Unified Modeling Language
Car Tire Gas Station Class Diagram – has-a relationship • Composition ( an filled diamond ) • The contained object is a part of the containing object • A Car has Tires as parts • Use relationship • A dash line with an arrow • Also called dependencyrelationship The Unified Modeling Language
Aircraft Jet Helicopter Airport Notes in the UML • A note • A box containing the message open diamondsmean aggregation The Unified Modeling Language
Aircraft Jet Helicopter Airport The Cardinality of the Relationship • How many aircraft does an airport have? 0..* 0..1 open diamondsmean aggregation The Unified Modeling Language
Car Tire Gas Station The Cardinality of the Relationship • Tires are on exactly one car. 1 4..5 The Unified Modeling Language
Outline • Overview • What is the UML? • Why use the UML? • The class diagram • Interaction Diagrams • Summary The Unified Modeling Language
Interactive Diagram • Class diagrams • Static relationships • Interactive diagrams • Showing how objects interact with each other • Sequence diagram • The most common type • Reading from top to down • Object:Class notation The Unified Modeling Language
Sequence Diagram The Unified Modeling Language
Outline • Overview • What is the UML? • Why use the UML? • The class diagram • Interaction Diagrams • Summary The Unified Modeling Language
Summary • Do not worry so much about creating diagrams the “right” way. • If you think something needs to be said, use a Note to say it. • If you aren’t sure about an icon or a symbol and you have to look up to find out its meaning, include a note to explain it since others may be unclear about its meaning, too. • Go for clarity. The Unified Modeling Language