You are on page 1of 17

sohailimran@yahoo.

com

activity diagram
Ref: Web
intro
In UML an activity diagram is used to display the sequence of activities. Activity Diagrams
show the workflow from a start point to the finish point detailing the many decision paths
that exist in the progression of events contained in the activity. They may be used to detail
situations where parallel processing may occur in the execution of some activities. Activity
Diagrams are useful for Business Modelling where they are used for detailing the
processes involved in business activities.
 Can model a task (for example in business modelling)
 Can describe a function of a system represented by use cases

 Can describe the logic of an operation

Also
◦ It is used to model the activities that make up the life cycle in the Unified Process

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 1


Case Study - Agate Ltd
 Agate is an advertising company
 Many companies are its clients
 Clients have advertising campaigns
 Each campaign includes one or more adverts
 Staff may work on several campaigns at a time
 Bonus is calculated depending on salary grade

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 2


Notation of Activity Diagrams

 Activities
◦ rectangle with rounded ends
Add a New
◦ meaningful name Client
 Transitions
◦ arrows with open
Assign Staff
arrowheads Contact

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 3


Notation
 Start state
◦ black circle Add a New
 Decision points Client

◦ diamond
 Guard conditions Assign Staff
Contact
◦ in square brackets
 Final state [no campaign to add]

◦ black circle in white circle [campaign to add]

Add New
Campaign

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 4


Alternative notation for branching
Add a New
Client
 Alternative notation for
branching: Assign Staff
Contact
[no campaign to add]

◦ alternative transitions
are shown leaving the
[campaign to add]

activity with guard Add New


conditions Campaign

 Note that guard conditions do not have to be


mutually exclusive, but it is advisable that
they should be

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 5


Swim-lanes

 Swim-lanes Campaign
Manager
Accountant Client

◦ vertical columns
◦ labelled with the Record Completion

person, organisation
of a campaign

or department Issue invoice


responsible for the
activities in that
column
Pay invoice

Record client
payment

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 6


example

 Identify activities
◦ What happens when a new client is added in the Add a New
Agate system? Client

 Add a New Client


 Assign Staff Contact Assign Staff
Contact
 Add New Campaign
 Assign Staff to Campaign
 Organise the activities in order with Add New
transitions Campaign

Assign Staff
to Campaign

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 7


example
 Identify any alternative
transitions and the
conditions on them Add a New
Client
◦ sometimes there is a new
campaign to add for a new Assign Staff [no campaign to add]
client, sometimes not Contact
◦ sometimes they will want [campaign to add]
to assign staff to the
campaign, sometimes not Add New [no staff to assign]

Add transitions and


Campaign

guard conditions to the [staff to assign]

diagram Assign Staff


to Campaign

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 8


repeated processes

 Identify any processes Add a New

that are repeated


Client

◦ they will want to assign staff [no campaign to add]


Assign Staff
to the campaign until there Contact
are no more staff to add
[campaign to add]
 Add transitions and guard
conditions to the diagram Add New [no staff to assign]
Campaign

[staff to assign]

[no more staff to assign]


Assign Staff
to Campaign
[more staff to assign]

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 9


example
 Are all the activities carried out by the same person,
organisation or department?
 If not, then add swim lanes to show the responsibilities
 Name the swim lanes Administrator Campaign Manager

 Show each activity in the


appropriate swim lane Add a New
Client

Assign Staff [no campaign to add]


Contact

[campaign to add]

Add New [no staff to assign]


Campaign

[staff to assign]

Assign Staff
to Campaign

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 10


example

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 11


Object flows
 Are there any object flows and objects to show?
◦ these can be documents that are created or updated in a
business activity diagram
◦ these can be object instances that change state in an
operation or a use case
 Add the object flows and objects
:Campaign

Object flows
[Active]

◦ dashed arrow Record completion
 Objects of a campaign

◦ rectangle
:Campaign
[Completed]
◦ with name of object underlined
◦ optionally shows the state of the object in square brackets

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 12


example
Administrator Campaign Manager

Add a New :Client


Client [New]

Assign Staff [no campaign to add]


Contact

[campaign to add]

:Campaign [no staff to assign]


Add New
[Commissioned] Campaign

[staff to assign]

Assign Staff
to Campaign

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 13


Decision and Merge Nodes
Decision nodes and merge nodes have the same notation: a diamond shape. They can
both be named. The control flows coming away from a decision node will have guard
conditions which will allow control to flow if the guard condition is met. The following
diagram shows use of a decision node and a merge node.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 14


Fork and Join Nodes
Forks and joins have the same notation: either a horizontal or vertical bar (the orientation is
dependent on whether the control flow is running left to right or top to bottom). They
indicate the start and end of concurrent threads of control. The following diagram shows an
example of their use.

A join is different from a merge in that the join synchronises two inflows and produces a
single outflow. The outflow from a join cannot execute until all inflows have been received.
A merge passes any control flows straight through it. If two or more inflows are received by
a merge symbol, the action pointed to by its outflow is executed two or more times.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 15


example

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 16

You might also like