7 Activity Diagrams
7 Activity Diagrams
Activity Diagrams
• Activity diagrams, which are related to program flow plans (flowcharts), are
used to illustrate activities. In the external view, we use activity diagrams for
the description of those business processes that describe the functionality of
the business system.
• Contrary to use case diagrams, in activity diagrams it is obvious whether
actors can perform business use cases together or independently from one
another.
• Activity diagrams allow you to think functionally. Purists of the object-
oriented approach probably dislike this fact. We, on the other hand, regard
this fact as a great advantage, since users of object-oriented methods, as
well as users of functional thinking patterns, find a common and familiar
display format, which is a significant aid for business-process modeling.
• Because it is possible to explicitly describe parallel events, the activity
diagram is well suited for the illustration of business processes, since
business processes rarely occur in a linear manner and often exhibit
parallelisms.
Activity Diagrams
► An Activity Diagram is on of the Behaviour diargams.
► Activity modelling is the sequence and conditions for coordinating
lower-level behaviours, rather than which classifiers own those
behaviours.
► These are commonly called control flow and object flow models.
► The behaviours coordinated by these models can be initiated because
other behaviours finish executing, because objects and data become
available, or because events occur external to the flow.
► A UML Activity Diagram shows sequential and parallel activities in a
process.
► Useful for modelling:
• ) Business processes
• ) Workflows
• ) Data flows
• ) Complex algorithms
Notation
Notation
• A UML activity diagram can be though of as a “flow chart on steroids”. At the highest level, it can
be thought of as a sketching tool, but has the facilities for providing detailed process information.
Here you can see the subset of available symbols necessary for the creation of a simple activity
diagram. For the full set of symbols see the MagicDraw documentation.
• Action – an activity or task that takes place. It can be a placeholder for lower level diagrams to
keep the number of symbols on a page down. Note that actions can correspond to concrete use
cases. Object Node – something created, edited or manipulated by actions.
• Control flow – transfer of focus from one action to another.
• Object flow – transfer of an object between actions The initial node starts a chain of activities A
final node signals the end of an action chain. A final flow stops all activity in its path and
terminates the transmission of any object or event.
• Decision – directs the flow of activity based on the evaluation of a decision (e.g. yes or no) Fork
allows the flow of actions to split and occur in parallel
• Join – merges activity flows into a single thread. However for a join, as opposed to a simple
merge, all the actions connecting to the join symbol must complete before the flow can continue.
• Guard condition – the thing evaluated in a decision node, e.g. the passenger “has baggage”.
Normally evaluates to a yes or no, which is shown on the diagram.
• Swimlanes – can be used to show the responsible parties (e.g. who, what) is performing an
activity (see backside of this page)
Notation
• ACTION It does something. There is automatic
transition on its completion. A transition (arrows
between actions) supports modelling of control flow.
• FORK One incoming transition, and multiple outgoing
parallel transitions and/or object flows.
• JOIN Multiple incoming transitions and/or object
flows; one outgoing transitions. The outgoing
continuation does not happen until all the inputs
arrive from all flows.
• OBJECT NODE An object produced or used by actions.
This allows us to model data flows or object flows.
Notation
►InitialNode:
•) An initial node is a control node at which flow
starts when the activity is invoked.
•) An activity may have more than one initial node.
►Final Node:
•) An activity may have more than one activity final
node; the first one reached stops all flows in the
activity.
Notation
►Action:
►An action represents a single step within an activity that is
not further decomposed within the activity.
►An activity represents a behaviour that is composed of
individual elements that are actions.
►An action is simple from the point of view of the activity
containing it, but may be complex in its effect and not be
atomic.
►An activity can be reused in many places, whereas an
instance of an action is only used once at a particular point
in an activity.
►An action will not begin execution until all of its input
conditions are satisfied.
Notation
Merge Node:
►A merge node is a control node that brings together multiple
alternate flows.
►It is not used to synchronize concurrent flows but to accept one
among several alternate flows.
►A merge node has multiple incoming edges and a single outgoing
edge.
Decision Node:
►A decision node accepts tokens on an incoming edge and presents
them to multiple outgoing edges.
►Which of the edges is actually traversed depends on the evaluation
Fork Node:
►A fork node is a control node that splits a flow into multiple
concurrent flows.
►A fork node has one incoming edge and multiple outgoing
edges.
Notation
► Note:
►A note (comment) gives the ability to attach various remarks to elements.
► A comment carries no semantic force, but may contain information that is
useful to a modeler
Notation
2. Transition
Activity1()c Activity2()
1. Activities
Notation - 2
[x>0]
[x>0]
Activity1()c
[x=0] [x=0]
[x<0] [x<0]
3. Decision Diamond
Notation - 4
Developers Testers Markers
Application/Department/Group/Role Boundaries
Activity Diagram
• Activity Diagram Example - Student Enrollment
• This UML activity diagram example describes a process for
student enrollment in a university as follows:
• An applicant wants to enroll in the university.
• The applicant hands a filled out copy of Enrollment Form.
• The registrar inspects the forms.
• The registrar determines that the forms have been filled out
properly.
• The registrar informs student to attend in university overview
presentation.
• The registrar helps the student to enroll in seminars
• The registrar asks the student to pay for the initial tuition.
Activity Diagram(Non-
Swimlane)
Activity Diagram - Swimlane
• A swimlane is a way to group activities performed by the same
actor on an activity diagram or activity diagram or to group
activities in a single thread. Here is an example of a Swimlane
activity diagram for modeling Staff Expenses Submission: