Activity Diagrams
Activity Diagrams
Activity Diagrams
Introduction
Activity diagrams are a behavioural model that
represent the dynamics of the system.
An activity diagram is essentially a fancy flowchart.
they show the flow of control from activity to activity
in the system,
What activities can be done in parallel and
any alternate paths in the flow.
Activity diagrams can be used to show the flow across
use cases or they may be used to represent the flow
within a particular use case
Introduction
Activity diagrams and state chart diagrams are
related.
Activity diagrams are a special type of state.
because activities are the state of doing something.
While a state chart diagram focuses attention on an
object undergoing a process (or on a process as an
object),
an activity diagram focuses on the flow of activities
involved in a single process.
Activity diagram shows the how those activities
depend on one another..
The diagrams describe the state of activities by
showing the sequence of activities performed.
Contents of an activity diagram
Create curriculum
Select course to teach
Create catalogue
Flow Transitions
Transitions are used to show the passing of the
control from one activity to another.
Shows how the action states are related to another.
They are triggered by the completion of the
behavior in the originating activity.
Create curriculum
Create catalogue
Types of transitions
Create curriculum
Create curriculum
No
Are all professors
Assigned?
Decisions
Create curriculum
No
Are all professors
Assigned?
Yes
Yes
Create catalogue
Open registration
Concurrency
Swimlanes
Swimlanes may be used to partition an activity diagram.
This is mainly done to show what person or organisation
is repsonsible for the activities contained in the
swimlane
For example, the project management system may have
the following swimlanes, which are illustrated in Figure
below:
Project Manager
Shows the action states that are the responsibility of a project
manager. The swimlane makes it obvious that the project
manager is responsible for entering data, thus the rather
cumbersome action state name of Project Manager Enters
Data may be shortened to Enter Data.
Swimlanes
Project Management System
Shows the action states that are the responsibility of the
project management system. Again, because the swimlane
makes it obvious who (or what, in this case) is generating
information, the rather cumbersome action state name of
Project Management System Generates Information may be
shortened to Generate Information.
Printer
Shows the action states that are the responsibility of a printer.
Because of this swimlane, the rather cumbersome action state
name of Printer Prints
Information may be shortened to Print Information.
Swimlanes
Registra Professor
Create curriculum
No
Are all professors
Assigned?
Yes
Yes
Create catalogue
Open registration
Swimlanes example
Initial and final activities
Create curriculum
No
Are all professors
Assigned?
Yes
Yes
Create catalogue
Open registration
Diagrams used
Initial node. The filled in circle is the starting point of the
diagram. An initial node isnt required although it does make it
significantly easier to read the diagram.
Activity final node. A filled circle (Bull eye) with a border is
the ending point. An activity diagram can have zero or more
activity final nodes.
Activity. The rounded rectangles represent activities that
occur. An activity may be physical, such as Inspect Forms, or
electronic, such as Display Create Student Screen.
Flow/edge. The arrows on the diagram.
Diagrams used
Fork. A black bar with one flow going into it and several
leaving it. This denotes the beginning of parallel activity.
Join. A black bar with several flows entering it and one
leaving it. This denotes the end of parallel processing.
Condition. Text such as [No] on a flow, defining a guard
which must evaluate to true in order to traverse the node.
Decision. A diamond with one flow entering and several
leaving. The flows leaving include conditions although
some modelers will not indicate the conditions if it is
obvious.
Diagrams used
Merge. A diamond with several flows entering and one
leaving. The implication is that all incoming flows must
reach this point until processing continues, unless otherwise.
Partition. Also called swimlanes, indicates who/what is
performing the activities.
Sub-activity indicator. The rake in the bottom corner of an
activity, indicates that the activity is described by a more
finely detailed activity diagram.
Flow final. The circle with the X through it. This indicates
that the process stops at this point.
Signal: When an activity sends or receives a message,
that activity is called a signal.
Signals are of two types: Input signal (Message receiving activity)
shown by a concave polygon and Output signal (Message sending
activity) shown by a convex polygon.
How to Draw: Activity Diagrams
Activity diagrams show the flow of activities through the
system.
Diagrams are read from top to bottom and have branches
and forks to describe conditions and parallel activities.
A fork is used when multiple activities are occurring at the same time.
The diagram below shows a fork after activity1.
This indicates that both activity2 and activity3 are occurring at the same
time.
After activity2 there is a branch.
The branch describes what activities will take place based on a set of
conditions.
All branches at some point are followed by a merge to indicate the end of
the conditional behavior started by that branch.
After the merge all of the parallel activities must be combined by a join
before transitioning into the final activity state.
Example
Below is a possible activity diagram for processing an
order.
The diagram shows the flow of actions in the system's
workflow.
Once the order is received the activities split into two
parallel sets of activities.
One side fills and sends the order while the other handles
the billing.
On the Fill Order side, the method of delivery is decided
conditionally.
Depending on the condition either the Overnight Delivery
activity or the Regular Delivery activity is performed.
Finally the parallel activities combine to close the order.
When to Use: Activity Diagrams
Activity diagrams should be used in conjunction with
other modeling techniques such as interaction diagrams
and state diagrams.
The main reason to use activity diagrams is to model the
workflow behind the system being designed.
Activity Diagrams are also useful for:
analyzing a use case by describing what actions need to take
place and when they should occur;
describing a complicated sequential algorithm;
and modeling applications with parallel processes.
However, activity diagrams should not take the place
of interaction diagrams and state diagrams.
Activity diagrams do not give detail about how objects behave
or how objects collaborate.