17
1 Interaction diagrams Interaction diagrams and activity diagrams and activity diagrams Speaker: Speaker: 陳 陳 陳 陳 陳 陳 Real-time and Embedded System Lab Real-time and Embedded System Lab 15 August 2002 15 August 2002

1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

Embed Size (px)

Citation preview

Page 1: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

11

Interaction diagrams and Interaction diagrams and activity diagramsactivity diagrams

Speaker: Speaker: 陳 奕 全陳 奕 全Real-time and Embedded System LabReal-time and Embedded System Lab

15 August 200215 August 2002

Page 2: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

22

OutlineOutline

• Introduction of interaction diagramsIntroduction of interaction diagrams

• Modeling flows of controlModeling flows of control

• Introduction of activity diagramsIntroduction of activity diagrams

• Modeling a workflowModeling a workflow

• Modeling a operation Modeling a operation

Page 3: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

33

Introduction of interaction Introduction of interaction diagramsdiagrams

• How do you model system’s dynamic How do you model system’s dynamic aspects?aspects?– To build up storyboards of scenarios.To build up storyboards of scenarios.

• In UML, you model these storyboards In UML, you model these storyboards by using interaction diagrams.by using interaction diagrams.

storyboard: noun,storyboard: noun, a series of drawings or pictures a series of drawings or pictures that show the outline of the story of a film/movie, that show the outline of the story of a film/movie, etc.etc.

Page 4: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

44

Introduction of interaction Introduction of interaction diagrams (Cont.)diagrams (Cont.)

• Interaction diagrams contain Interaction diagrams contain sequence sequence diagramsdiagrams and and collaboration diagramscollaboration diagrams. .

• Sequence diagrams: emphasis the Sequence diagrams: emphasis the time time orderingordering of messages. of messages.

• Collaboration diagrams: emphasis the Collaboration diagrams: emphasis the structural organizationstructural organization of objects that of objects that send/receive messages. send/receive messages.

• Both of them are semantically Both of them are semantically equivalent.equivalent.

Page 5: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

55

Introduction of interaction Introduction of interaction diagrams (Cont.)diagrams (Cont.)

• Sequence diagramsSequence diagrams • Collaboration diagramsCollaboration diagrams

Page 6: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

66

Modeling flows of controlModeling flows of control

• By time ordering:By time ordering:– Set the context for the interaction.Set the context for the interaction.– Set the stage for the interaction.Set the stage for the interaction.– Set the lifeline for each objectSet the lifeline for each object– Starting with the message Starting with the message – Visualize the nesting of messages (optional)Visualize the nesting of messages (optional)– Specify time or space constraints (optional)Specify time or space constraints (optional)

Page 7: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

77

Modeling flows of control Modeling flows of control (Cont.)(Cont.)

Page 8: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

88

Modeling flows of control Modeling flows of control (Cont.)(Cont.)

• By organization:By organization:– Set the context for the interactionSet the context for the interaction– Set the stage for the interactionSet the stage for the interaction– Set the initial properties of each objectSet the initial properties of each object– Specify the links among Specify the links among – Starting with the messages that initiates Starting with the messages that initiates

this interactionthis interaction– Specify time or space constraints Specify time or space constraints

(optional)(optional)

Page 9: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

99

Modeling flows of control Modeling flows of control (Cont.)(Cont.)

Page 10: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1010

Introduction of activity Introduction of activity diagramsdiagrams• Consider the workflow associated with Consider the workflow associated with

building a house.building a house.– select site, commission an architect, develop select site, commission an architect, develop

plan, bid plan, construction…until everything is plan, bid plan, construction…until everything is done.done.

• In a real project, there are a lots of parallel In a real project, there are a lots of parallel activities among various trades.activities among various trades.

• We can model these dynamic aspects We can model these dynamic aspects using activity diagrams.using activity diagrams.

Page 11: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1111

Introduction of activity Introduction of activity diagrams (Cont.)diagrams (Cont.)

• Activity diagrams shows the flow from aActivity diagrams shows the flow from activity to activity.ctivity to activity.

• Activity: an ongoing nonatomic executioActivity: an ongoing nonatomic execution within a state machine. n within a state machine.

Activity ActionMade up of executable atomic computations (send a signal, create, destroy)

Page 12: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1212

Introduction of activity Introduction of activity diagrams (Cont.)diagrams (Cont.)• Activity diagrams commonly contain:Activity diagrams commonly contain:

– Activity states and action statesActivity states and action states– TransitionTransition

• Sequential transition, branching, forking and joining.Sequential transition, branching, forking and joining.

Page 13: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1313

Introduction of activity diagrams Introduction of activity diagrams (Cont.)(Cont.)– ObjectsObjects

• Swimlane: modeling Swimlane: modeling workflows of businesworkflows of business processes.s processes.

• Flow of object: Usage Flow of object: Usage of dependency relatiof dependency relationships and objectsonships and objects

Page 14: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1414

Modeling a workflowModeling a workflow

• To model a workflowTo model a workflow– Establish a focus for the workflow.Establish a focus for the workflow.– Select the business objects.Select the business objects.– Identify the conditions of the workflow’s states.Identify the conditions of the workflow’s states.– Specify the activities and actions and render Specify the activities and actions and render

them in diagramsthem in diagrams– Render transitions the connect activity and Render transitions the connect activity and

action states.action states.– Render important objects in the activity Render important objects in the activity

diagrams.diagrams.

Page 15: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1515

Modeling a workflow (Cont.)Modeling a workflow (Cont.)

Page 16: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1616

Modeling a operationModeling a operation

• To model a operation:To model a operation:– Collect the abstractions that are involved in Collect the abstractions that are involved in

this operationthis operation– Identify the precondition and postconditionIdentify the precondition and postcondition– Specify the activities and actions and render Specify the activities and actions and render

them in diagramsthem in diagrams– Specify conditional paths and iteration.Specify conditional paths and iteration.– Use forking and joining to specify parallel flUse forking and joining to specify parallel fl

ows of controlows of control

Page 17: 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab 15 August 2002

1717

Modeling a operationModeling a operation

Signature: one parameter and one return value