Lab 4
Lab 4
M (CS0601) 6CSEB2
PRACTICAL -04
Aim: Draw an Activity diagram for the selected application.(Online Shopping Website)
Activity Diagrams
An activity diagram is a type of Unified Modelling Language (UML) flowchart that shows the flow
from one activity to another in a system or process. It's used to describe the different dynamic aspects
of a system and is referred to as a 'behaviour diagram' because it describes what should happen in the
modelled system.
In activity diagrams, the notations are like visual symbols that help represent different elements and actions in a
simple way.
Page 1 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
Page 2 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
2.5. Guard
A Guard refers to a statement written next to a decision node on an arrow sometimes within square brackets.
The statement must be true for the control to shift along a particular direction. Guards help us know the
constraints and conditions which determine the flow of a process.
2.6. Fork
Fork nodes are used to support concurrent activities. When we use a fork node when both the activities get
executed concurrently i.e. no decision is made before splitting the activity into two parts. Both parts need to be
executed in case of a fork statement. We use a rounded solid rectangular bar to represent a Fork notation with
incoming arrow from the parent activity state and outgoing arrows towards the newly created activities.
For example:
In the example below, the activity of making coffee can be split into two concurrent activities and hence we use
the fork notation.
2.7. Join
Join nodes are used to support concurrent activities converging into one. For join notations we have two or
more incoming edges and one outgoing edge.
For example:
Page 3 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
When both activities i.e. steaming the milk and adding coffee get completed, we converge them into one final
activity.
2.9. Swimlanes
We use Swimlanes for grouping related activities in one column. Swimlanes group related activities into one
column or one row. Swimlanes can be vertical and horizontal. Swimlanes are used to add modularity to the
activity diagram. It is not mandatory to use swimlanes. They usually give more clarity to the activity diagram.
It’s similar to creating a function in a program. It’s not mandatory to do so, but, it is a recommended practice.
We use a rectangular column to represent a swimlane as shown in the figure above.
For example:
Page 4 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
Here different set of activities are executed based on if the number is odd or even. These activities are grouped
into a swimlane.
Page 5 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
Page 6 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
Page 7 of 8
IU2141230108 S.E.P.M (CS0601) 6CSEB2
Page 8 of 8