Activity Diagram
Activity Diagram
We use Activity Diagrams to illustrate the flow of control in a system and refer
to the steps involved in the execution of a use case. We model sequential and
concurrent activities using activity diagrams. So, we basically depict workflows
visually using an activity diagram. An activity diagram focuses on condition of
flow and the sequence in which it happens. We describe or depict what causes a
particular event using an activity diagram.
Figure – an activity diagram for an emotion based music player The above figure
depicts an activity diagram for an emotion based music player which can also be
used to change the wallpaper.
The various components used in the diagram and the standard notations are
explained below.
1. Initial State – The starting state before an activity takes place is depicted
using the initial state.
Action Flow or Control flows – Action flows or Control flows are also referred
to as paths and edges. They are used to show the transition from one activity
state to another.
Figure –
using action flows for transitions
2. Decision node and Branching – When we need to make a decision before
deciding the flow of control, we use the decision node.
1.
2. Figure – an activity diagram using decision node
3. Guards – A Guard refers to a statement written next to a decision node on
an arrow sometimes within square brackets.
1. Figure – guards being used next to a decision node
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.
Fork – Fork nodes are used to support concurrent activities.
2. Final State or End State – The state which the system reaches when a
particular process or activity ends is known as a Final State or End State. We
use a filled circle within a circle notation to represent the final state in a state
machine diagram. A system or a process can have multiple final states.