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

Post on 02-Jan-2016

224 views 1 download

Transcript of 1 Interaction diagrams and activity diagrams Speaker: 陳 奕 全 Real-time and Embedded System Lab...

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

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

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.

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.

55

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

• Sequence diagramsSequence diagrams • Collaboration diagramsCollaboration diagrams

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)

77

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

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)

99

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

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.

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)

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.

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

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.

1515

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

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

1717

Modeling a operationModeling a operation

Signature: one parameter and one return value