Lecture 28
Lecture 28
Ashish Kumar
Dept. of CSE
Manipal University Jaipur
1
What is an Activity Diagram?
Activity diagrams represent the dynamic (behavioral)
view of a system.
Activity diagrams are typically used for business
(transaction) process modeling and modeling the logic
captured by a single use-case or usage scenario.
Activity diagram is used to represent the flow
across use cases or to represent flow within a
particular use case.
A special kind of Statechart diagram, but showing
the flow from activity to activity (not from state to
state).
UML activity diagrams are the object oriented
equivalent of flow chart and data flow diagrams in
function-oriented design approach.
Activity diagram contains activities, transitions
2
What is an Activity Diagram?
The main reason to use activity diagrams is to model
the workflow behind the system being designed.
Diagrams are read from top to bottom and have
branches and forks to describe conditions and parallel
activities.
Activity diagrams do not give detail about how objects
behave or how objects collaborate.
They can show activities that are conditional or
parallel.
Activity Diagrams are useful for describing
complicated methods
Activity Diagrams are useful for describing use cases,
since, after all, a use case is an interaction, which is a
form of activity.
Activity Diagrams are like Flow Charts, but Flow3
When to Use Activity Diagrams
Do use them for
Analysing Use Cases.
Understanding workflow across many Use
Cases.
Dealing with multi-threaded applications.
4
Basic Components of Activity Diagram
Initial / Start node
The filled circle is the starting point of the diagram.
Final node
The filled circle with a boarder is the ending point. An activity diagram
can have zero or more activity final state.
Activity
An activity is an ongoing, though interruptible, execution of a step in a
workflow (such as an operation or transaction).
The rounded rectangle represents activities that occur. An activity is not
necessarily a program, it may be a manual work also.
Text in the activity box should represent an activity (verb phrase in
present tense).
Flow / Edge
The arrows in the diagram. No label is necessary.
5
Basic Components of Activity Diagram
Fork
A black bar ( horizontal/vertical ) with one flow going into
it and several leaving it. This denotes the beginning of
parallel activities.
Join
A black bar with several flows entering it and one leaving it.
This denotes the end of parallel activities.
Merge
A diamond with several flows entering and one leaving. The
implication is that all incoming flow to reach this point until
processing continues.
6
Basic Components of Activity Diagram
Decision
A diamond with one flow
entering and several leaving.
The flow leaving includes
conditions as yes/ no state
Flow final
The circle with X though it.
This indicates that Process
stop at this point
Swim lane
A partition in activity
diagram by means of solid
line, called swim lane. This
swim lane may be
horizontal or vertical. 8
Join
A join may have two or more incoming transitions
and one outgoing transition.
Above the join, the activities associated with
each of these paths continues in parallel.
At the join, the concurrent flows synchronize.
Each waits until all incoming flows have
9
Fork
A fork may have one incoming transitions and
two or more outgoing transitions.
Each transition represents an independent
flow of control.
Conceptually, the activities of each of outgoing
transitions are concurrent.
Either truly concurrent (multiple nodes)
10
Swimlanes
A swimlane specifies a locus of activities.
To partition the activity states on an activity
diagram into groups.
Each group representing the business organization
responsible for those activities.
Each group is called a swimlane.
Each swimlane is divided from its neighbor by a
vertical solid line.
Each swimlane has a name unique within its
diagram.
Each swimlane may represent some real-world
entity.
Each swimlane may be implemented by one or
more classes. 11
Example
Start State
Activity
Fork
Decision
Merge Join
End
State 12
Withdraw money from a
Example bank account through an
ATM
13
Advantages of Activity Diagrams
An activity diagram can depict a model in several
ways.
It can also depicts “Basic course of action” as
well as “detailed courses”.
Activity diagram can also be drawn that cross
several use cases, or that address just a small
portion of use case.
Activity diagrams are normally employed in
business process modeling. This is carried out
during the initial stages of requirement analysis
and specification.
Activity diagrams can be very useful to
understand the complex processing activities
14
involving many components.
Disadvantages of Activity Diagrams
A disadvantage of activity diagrams is that they
do not explicitly present which objects execute
which activities, and the way that the messaging
works between them.
Labeling of each activity with the responsible object
can be done.
It is useful to draw an activity diagram early in the
modeling of a process, to help understand the
overall process.
Then interaction diagrams can be used to help
you allocate activities to classes.
15
Object Flow
Objects connected using a dependency to the
activity or transition that creates, destroys, or
modifies them.
A special sort of step (state) that represents the
availability of a particular kind of object, perhaps
in a particular state.
No action or subactivity is invoked and control
passes immediately to the next step (state).
Places constraints on input and output
parameters of steps before and after it.
Dashed lines used with object flow have the same
semantics as any other flow or edge.
Class
[State]
16
Object Flow
Objects connected using a dependency to the
activity or transition that creates, destroys, or
modifies them
17
Object Flow In this diagram,
Object flow should
always be in dashed
line, not solid line.
21