Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Introduction to UML DIAGRAMS & CLASS DIAGRAM Chapter 7,8 主講人 : 許勝杰

Similar presentations


Presentation on theme: "1 Introduction to UML DIAGRAMS & CLASS DIAGRAM Chapter 7,8 主講人 : 許勝杰"— Presentation transcript:

1 1 Introduction to UML DIAGRAMS & CLASS DIAGRAM Chapter 7,8 主講人 : 許勝杰 jason@rtpc06.ee.ncku.edu.tw

2 2 Outline Different Views of a System Different Views of a System Diagrams Diagrams Structural Diagrams Structural Diagrams Behavioral Diagrams Behavioral Diagrams Class Diagram Class Diagram Examples : An ATM System Examples : An ATM System

3 3 Different Views of a System A view is a projection into the organization and structure of a system’s model, focused on one aspect of a system. A view is a projection into the organization and structure of a system’s model, focused on one aspect of a system. Five most important views : Five most important views : Use case view: force the shape of system. Use case view: force the shape of system. Design view: function requirements. Design view: function requirements. Process view: concurrency, synchronization. Process view: concurrency, synchronization. Implementation view: component and files assemble the physical system. Implementation view: component and files assemble the physical system. Deployment view: nodes form H/W topology Deployment view: nodes form H/W topology

4 4 Diagrams A diagram is a graphical projection into the elements that make up a system. A diagram is a graphical projection into the elements that make up a system. Each diagram provides a view into the elements that make up the system. Each diagram provides a view into the elements that make up the system. Structural diagrams to view the static parts and Behavioral diagrams to view the dynamic parts of a system. Structural diagrams to view the static parts and Behavioral diagrams to view the dynamic parts of a system.

5 5 Structural Diagrams The UML’s structural diagrams are used to visualize, specify, construct, and document the static aspects of a system. The UML’s structural diagrams are used to visualize, specify, construct, and document the static aspects of a system. Static aspects: represent system’s relatively stable skeleton and scaffolding. Static aspects: represent system’s relatively stable skeleton and scaffolding. UML’s four structural diagrams: UML’s four structural diagrams: Class diagrams Class diagrams Object diagrams Object diagrams Component diagrams Component diagrams Deployment diagrams Deployment diagrams

6 6 Structure Diagrams - Class Diagrams A class diagram shows a set of classes, interfaces, and collaborations and their relationship. A class diagram shows a set of classes, interfaces, and collaborations and their relationship. Class diagrams are used to illustrate the static design view of a system. Class diagrams are used to illustrate the static design view of a system. Class diagrams including active classes are used to address the static process view of a system. Class diagrams including active classes are used to address the static process view of a system.

7 7 Structure Diagrams - Object Diagrams A object diagram show a set of objects and their relationships. A object diagram show a set of objects and their relationships. Object diagrams are used to illustrate data structures, the static snapshots of instances of the things founds in class diagrams. Object diagrams are used to illustrate data structures, the static snapshots of instances of the things founds in class diagrams. Object diagrams address the static design view of a system just as do class diagrams, but from the perspective of real or prototypical case. Object diagrams address the static design view of a system just as do class diagrams, but from the perspective of real or prototypical case. Ref. P.196, Fig 14-1 Ref. P.196, Fig 14-1 Ref. P.196, Fig 14-1 Ref. P.196, Fig 14-1

8 8 Structure Diagrams - Component Diagrams A component diagram shows a set of components and their relationships. A component diagram shows a set of components and their relationships. Component diagrams are used to illustrate static implementation view of a system. Component diagrams are used to illustrate static implementation view of a system. A component typically maps to one or more classes, interfaces, or collaborations. A component typically maps to one or more classes, interfaces, or collaborations. Ref. P.394, Fig.29-1 Ref. P.394, Fig.29-1 Ref. P.394, Fig.29-1 Ref. P.394, Fig.29-1

9 9 Structure Diagrams - Deployment Diagrams A deployment diagram shows a set of nodes and their relationships. A deployment diagram shows a set of nodes and their relationships. Deployment diagrams illustrate the static deployment view of an architecture. Deployment diagrams illustrate the static deployment view of an architecture. Ref. P.408, Fig. 30-1 Ref. P.408, Fig. 30-1 Ref. P.408, Fig. 30-1 Ref. P.408, Fig. 30-1

10 10 Behavioral Diagrams The UML’s behavioral diagrams are used to visualize, specify, construct, and document the dynamic aspects of a system. The UML’s behavioral diagrams are used to visualize, specify, construct, and document the dynamic aspects of a system. Dynamic aspects: represent a system’s changing parts. Dynamic aspects: represent a system’s changing parts. UML’s five behavioral diagrams UML’s five behavioral diagrams Use case diagrams Use case diagrams Sequence diagrams Sequence diagrams Collaboration diagrams Collaboration diagrams Statechart diagrams Statechart diagrams Activity diagrams Activity diagrams

11 11 Behavioral Diagrams- Use Case Diagram A use case shows a set of use cases and actors and their relationships. A use case shows a set of use cases and actors and their relationships. Used to illustrate the static use case view of a system. Used to illustrate the static use case view of a system. Especially important in organizing and modeling the behaviors of a system. Especially important in organizing and modeling the behaviors of a system.

12 12 Behavioral Diagrams- Sequence Diagram A sequence diagram is an interaction diagram that emphasizes the time ordering of messages. A sequence diagram is an interaction diagram that emphasizes the time ordering of messages. It shows a set of objects and the messages sent and received by those objects. It shows a set of objects and the messages sent and received by those objects. Used to illustrate the dynamic view of a system. Used to illustrate the dynamic view of a system.

13 13 Behavioral Diagrams- Collaboration Diagram A collaboration diagram is an interaction diagram that emphasize the structural organization of objects that send and receive messages. A collaboration diagram is an interaction diagram that emphasize the structural organization of objects that send and receive messages. It shows a set of objects, links among those objects, and messages sent and received by those objects. It shows a set of objects, links among those objects, and messages sent and received by those objects. Used to illustrate dynamic view of a system. Used to illustrate dynamic view of a system.

14 14

15 15 Behavioral Diagram- Statechart Diagram A statechart diagram shows a state machine, consisting of states, transitions, events, and activities. A statechart diagram shows a state machine, consisting of states, transitions, events, and activities. Especially important in modeling the behavior of an interface, class, or collaboration. Especially important in modeling the behavior of an interface, class, or collaboration. It emphasizes the event-ordered behavior of an object, which is especially useful in modeling reactive systems. It emphasizes the event-ordered behavior of an object, which is especially useful in modeling reactive systems. Illustrating dynamic view of a system. Illustrating dynamic view of a system.

16 16 Statechart Diagram (p.333)Activity Diagram (p.259)

17 17 Behavioral Diagrams- Activity Diagram An activity diagram shows the flow from activity to activity within a system. An activity diagram shows the flow from activity to activity within a system. It shows a set of activities, the sequential or branching flow from activity to activity, and objects that act and are acted. It shows a set of activities, the sequential or branching flow from activity to activity, and objects that act and are acted. Especially important in modeling the function of a system. Especially important in modeling the function of a system. It emphasizes the flow of control among objects. It emphasizes the flow of control among objects.

18 18 Class Diagram Class diagram commonly contains the following things: Class diagram commonly contains the following things: Classes Classes Interfaces Interfaces Collaborations Collaborations Dependency, generalization, and association relationships. Dependency, generalization, and association relationships. It may also contains notes and constraints, packages or subsystems It may also contains notes and constraints, packages or subsystems

19 19 Class Diagram Example: Example: Fig 8-1 p.106

20 20 Class Diagram A well-structured class diagram A well-structured class diagram Focused on communicating one aspect of a system’s static design view Focused on communicating one aspect of a system’s static design view Contain only elements that are essential to understanding that aspect Contain only elements that are essential to understanding that aspect Provides detail consistent with its level of abstraction, with adornments that are essential for understanding Provides detail consistent with its level of abstraction, with adornments that are essential for understanding Is not so minimalist that it misinform readers about important semantics. Is not so minimalist that it misinform readers about important semantics.

21 21 Class Diagram When drawing a class diagram: When drawing a class diagram: Give name communicating its purpose. Give name communicating its purpose. Layout elements with minimal cross line Layout elements with minimal cross line Semantically close, lay out close. Semantically close, lay out close. Use notes and color to draw attention to important features of system. Use notes and color to draw attention to important features of system. Try not to show too many kinds of relationships. Try not to show too many kinds of relationships.

22 22 An Example – ATM System The ATM system. The ATM system. Model collaboration Model collaboration Identify the mechanism. Identify the mechanism. Identify the classes, interface of each mechanism. Identify the classes, interface of each mechanism. Use scenarios to walk through these things. Use scenarios to walk through these things. Populate these elements with their contents. Populate these elements with their contents.

23 23 An Example – ATM System 密碼 金額 金融卡 櫃員機 checkCard() checkPW () getMoney() 顧客 inputCard() inputPW() inputMoney() 1..* 1 1 1 1

24 24 Object Diagram

25 25 Component Diagram

26 26 Deployment Diagram


Download ppt "1 Introduction to UML DIAGRAMS & CLASS DIAGRAM Chapter 7,8 主講人 : 許勝杰"

Similar presentations


Ads by Google