Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.

Similar presentations


Presentation on theme: "Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information."— Presentation transcript:

1 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

2 2Ku-Yaw ChangThe Unified Modeling Language Outline Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary

3 3Ku-Yaw ChangThe Unified Modeling Language Overview A brief overview of the Unified Modeling Language (UML) What the UML is and why to use it What the UML is and why to use it Essential UML diagrams Essential UML diagrams The Class Diagram The Interaction Diagram

4 4Ku-Yaw ChangThe Unified Modeling Language Outline Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary

5 5Ku-Yaw ChangThe Unified Modeling Language What is the UML? A visual language to create models of programs A drawing notation with semantics A drawing notation with semantics A diagrammatic representation of the programs A diagrammatic representation of the programs Different diagrams for Analysis Analysis Design Design Implementation (dissemination) Implementation (dissemination)

6 6Ku-Yaw ChangThe Unified Modeling Language UML Diagrams In the analysis phase Use Case Diagrams Use Case Diagrams Entities interacting with the system Function points Activity Diagrams Activity Diagrams Workflow of the problem domain Looking at object interactions Interaction Diagrams Interaction Diagrams How specific objects interact with each other Sequence Diagram is the most popular

7 7Ku-Yaw ChangThe Unified Modeling Language UML Diagrams In the design phase Class Diagrams Class Diagrams Detail the relationships between the classes Looking at an object’s behaviors State Diagrams State Diagrams Detail the different states an object may be in The transitions between these states In the deployment phase Deployment Diagrams Deployment Diagrams How different modules will be deployed

8 8Ku-Yaw ChangThe Unified Modeling Language Outline Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary

9 9Ku-Yaw ChangThe Unified Modeling Language Why Use the UML? For communication With yourself, team members and customers With yourself, team members and customers For clarity To determine if my understanding of the system is the same as others To determine if my understanding of the system is the same as others For precision A better way of describing object-oriented designs A better way of describing object-oriented designs Force the designer to think through his/her approach Force the designer to think through his/her approach

10 10Ku-Yaw ChangThe Unified Modeling Language Outline Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary

11 11Ku-Yaw ChangThe Unified Modeling Language The Class Diagram The most basic of UML diagram Describe classes Describe classes Show the relationships between them Show the relationships between them When one class is a “kind of” another class is-a relationship is-a relationship When there are associations between two classes One class “contains” another class: the has-a relationship 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 One class “uses” another class

12 12Ku-Yaw ChangThe Unified Modeling Language Class Information Each rectangle represents a class The name of the class The name of the class The data members of the class The data members of the class The methods (functions) of the class The methods (functions) of the class Notation for access Public Public Notated with a plus sign (+) Protected Protected Notated with a pound sign (#) Private Private Notated with a minus sign (-)

13 13Ku-Yaw ChangThe Unified Modeling Language Class Diagram – Its Three Variations Square +display() Square -length : double +display() Whenever we refer to a class name, we will bold it as done here.

14 14Ku-Yaw ChangThe Unified Modeling Language Class Diagram – is-a relationship Shape is italicized – meaning it is an abstract class ShapeLineSquarePoint

15 15Ku-Yaw ChangThe Unified Modeling Language Class Diagram – has-a relationship Aggregation ( an unfilled diamond ) Airport has Aircraft Airport has Aircraft Aircraft is not part of Airport Aircraft is not part of Airport AircraftJetHelicopterAirport

16 16Ku-Yaw ChangThe Unified Modeling Language Class Diagram – has-a relationship Composition ( an filled diamond ) The contained object is a part of the containing object The contained object is a part of the containing object A Car has Tires as parts A Car has Tires as parts Use relationship A dash line with an arrow A dash line with an arrow Also called dependency relationship Also called dependency relationship CarTireGas Station

17 17Ku-Yaw ChangThe Unified Modeling Language Notes in the UML A note A box containing the message A box containing the message AircraftJetHelicopterAirport open diamonds mean aggregation

18 18Ku-Yaw ChangThe Unified Modeling Language The Cardinality of the Relationship How many aircraft does an airport have? AircraftJetHelicopterAirport open diamonds mean aggregation 0..1 0..*

19 19Ku-Yaw ChangThe Unified Modeling Language The Cardinality of the Relationship CarTireGas Station Tires are on exactly one car. 1 4..5

20 20Ku-Yaw ChangThe Unified Modeling Language Outline Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary

21 21Ku-Yaw ChangThe Unified Modeling Language Interactive Diagram Class diagrams Static relationships Static relationships Interactive diagrams Showing how objects interact with each other Showing how objects interact with each other Sequence diagram Sequence diagram The most common type Reading from top to down Object:Class notation Object:Class notation

22 22Ku-Yaw ChangThe Unified Modeling Language Sequence Diagram

23 23Ku-Yaw ChangThe Unified Modeling Language Outline Overview What is the UML? Why use the UML? The class diagram Interaction Diagrams Summary

24 24Ku-Yaw ChangThe 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 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. 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. Go for clarity.

25 The End


Download ppt "Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information."

Similar presentations


Ads by Google