Activity Case
Activity Case
Activity Diagrams
1
Activity Diagrams
• Activity Diagrams consist of activities, states and transitions between activities
and states
Activity Diagrams
Slide 1: Activity Diagrams
Activity Diagrams
• Model business workflows
Activity Diagrams
Basics 3
Activity Diagrams
• Activities and Actions
• Transitions and Activity Edges
• Tokens and Activity Nodes
• Control Nodes
– Initial and Final Nodes
– Forks and Joins
– Decision and Merge Points
• States
• Swimlanes
Activity Diagrams
Example 4
Activity Diagram
Activities
• An Activity is the process being modelled
• An activity is like a state where the criterion for leaving the state is the
completion of the activity
Activity Diagrams
6
Actions
• An Action is a step in the overall activity
Activity Diagrams
7
Transitions
• A Transition is the movement from one activity to another, the change
from one state to another, or the movement between a state and an
activity in either direction
• Transitions take place when one activity is complete and the next can commence
Activity Diagrams
8
Activity Edges
• The flow of an activity is shown using arrowed lines called edges or paths
Activity Diagrams
Slide 8: Activity Edges
Tokens
• Conceptually, UML models information moving along an edge as a token
(e.g., real data, an object or focus of control)
Activity Diagrams
10
Activity Nodes
• UML 2.0 defines several types of activity nodes to model different types of
information flow
– Parameters nodes
– Object nodes
– (input or output) Pins - special notation for object nodes; exception pins,
value pins
Activity Diagrams
Example 11
Activity Diagrams
12
• A flow final node terminates a path through an activity, but not the
entire activity
Activity Diagrams
Example 13
Final Nodes
Warnings: be careful when using a flow final node after a fork. As soon as the
activity final node is reached, all other actions in the activity (including the ones
before the final flow node) terminate. If you want all forked actions to
finish, make sure to add a join.
Forks
• A transition can be split into multiple paths and multiple paths combined into
a single transitions by using a synchronisation bar
• On an occurrence of the transition all the activities with arcs from the
transition are initiated
• A fork node splits the current flow through an activity into multiple concurrent
flows
Activity Diagrams
Slide 14: Forks
In a detailed design model, you can use forks to represent multiple processes or
multiple threads in a program.
15
Joins
• A join is where the paths meet
Activity Diagrams
16
• Guard expressions (inside []) label the transitions coming out of a branch
• A merge point brings together alternate flows into a single output flow -
note that it does not synchronise multiple concurrent flows
Activity Diagrams
17
States
• A state in an activity diagram is a point where some event needs to take place
before activity can continue
Activity Diagrams
18
• There can be several End states – multiple End states can be used to
indicated different follow-on processes from a particular process
Activity Diagrams
19
Swimlanes
• Swimlanes (or activity partitions) indicate where activities take place.
• Swimlanes can also be used to identify areas at the technology level where
activities are carried out
Activity Diagrams
Slide 19: Swimlanes
Partitions may be constructed on the basis of:
• Partitioning by class and actor can help to identify new associations that have
not been documented in the class model
• Partitioning by use cases can help document how use cases interact
Slide 19: Smimlanes – Example
20
• A receive signal has the effect of waking up an action in your activity diagram
Activity Diagrams
Slide 20: Sending and Receiving Signals
• Note that combining send and receive signals results in behaviour similar to
synchronous call, or a call that waits for a response.
Activity Diagrams
Example 22
Activity Diagrams
Slide 22: Advanced Activity Modelling
• Connectors
• UML 2.0 provides supports for modelling Exception Handling
• It is possible to show that an action, or set of actions, executes over a collection
of input data by placing the action in an Expansion Region (<<parallel>>,
<<iterative>> or <<stream>>)
• UML 2.0 defines a construct to mode looping in activity diagrams – A loop
node has three subregions: setup, body and test
• An action is said to be streaming if it can produce output while it is
processing input
• Interruptible activity region
• UML 2.0 introduces a new type of activity node, called the central buffer
node, that provides a place to specify queueing functionality for data passing
between object nodes
• A data store node is a special type of central buffer node that copies all data
that passes through it
Activity Diagrams for Use Case Modelling 23
Activity Diagrams
Activity Diagrams for Business Modelling 24
Activity Diagrams
25
Readings
Required Readings
Activity Diagrams
26
Summary
• Activity Diagrams are good for describing synchronization and concurrency
between activities
• Activity diagrams are useful for capturing detailed activities, but they can also
capture elements of the high level workflow the system is intended to support
Activity Diagrams