Activity Diagram
Activity Diagram
SOFTWARE ENGINEERING 2
DIAGRAM
NINA JANE BOHOLST
SAMANTHA JULIA DONAIRE
WHAT IS AN
ACTIVITY DIAGRAM?
Activity diagrams show the steps involved in how a system works, helping
us understand the flow of control. They display the order in which
activities happen and whether they occur one after the other (sequential)
or at the same time (concurrent). These diagrams help explain what
triggers certain actions or events in a system.
happen and whether they occur one after the other (sequential) or at the
same time (concurrent). These diagrams help explain what triggers certain
actions or events in a system.
WHAT IS AN
ACTIVITY DIAGRAM?
An activity diagram starts from an initial point and ends at a final point,
showing different decision paths along the way.
They are often used in business and process modeling to show how a
system behaves over time.
Decision Decision
WHEN TO USE ACTIVITY DIAGRAM?
Activity diagrams are useful in several scenarios, especially when you need to visually represent the flow
of processes or behaviors in a system. Here are key situations when you should use an activity diagram:
01 02 03
MODELING WORKFLOWS CONCURRENT OR UNDERSTANDING THE
OR PROCESSES PARALLEL PROCESSING DYNAMIC BEHAVIOR
When you need to map out a business If your system or process involves When it’s essential to depict how a
process, workflow, or the steps activities happening simultaneously, system changes over time and moves
involved in a use case, activity an activity diagram can clearly show between different states based on events
diagrams help visualize the flow of the parallel flow of tasks. or conditions, activity diagrams are
activities.
effective.
WHEN TO USE ACTIVITY DIAGRAM?
Activity diagrams are useful in several scenarios, especially when you need to visually represent the flow
of processes or behaviors in a system. Here are key situations when you should use an activity diagram:
04 05 06
CLARIFYING COMPLEX SYSTEM DESIGN AND DESCRIBING USE
LOGIC ANALYSIS CASES
In activity diagrams, the notations are like visual symbols that help represent
different elements and actions in a simple way.
1. INITIAL STATE
The starting state before an activity takes place is depicted using the initial state.
EXAMPLE
Here the initial state of the system before the application is opened.
2. ACTION OR ACTIVITY
STATE
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 activity state.
EXAMPLE
Here both the states transit into one final state using action flow symbols i.e. arrows.
4. DECISION NODE AND BRANCHING
When we need to decide before choosing the flow of control, we use the decision
node. The outgoing arrows from the decision node can be labelled with conditions or
guard expressions. It always includes two or more output arrows.
EXAMPLE
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.
EXAMPLE
In the example below, the activity of making coffee can be split into two
concurrent activities and hence we use the fork notation.
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.
EXAMPLE
When both activities i.e. steaming the milk and adding coffee get completed,
we converge them into one final activity.
8. MERGE OR MERGE EVENT
Scenarios arise when activities which are not being executed concurrently have to be merged. We
use the merge notation for such scenarios.
EXAMPLE
In the diagram below: we can’t have both sides executing concurrently, but they finally
merge into one. A number can’t be both odd and even at the same time.
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.
EXAMPLE
Here, a different set of activities is executed based on if the number is odd or even.
These activities are grouped into a swimlane.
10. TIME EVENT
This refers to an event that stops the flow for a time; an hourglass depicts it. We can have a
scenario where an event takes some time to complete.
EXAMPLE
Let us assume that the processing of an image takes a lot of time. Then it can be
represented as shown below.
11. 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.
HOW TO DRAW AN ACTIVITY DIAGRAM
IN UML?
STEP 1. IDENTIFY THE INITIAL STATE
AND FINAL STATES:
For example, if you are modelling a process for making a cup of tea, the
initial state could be “No tea prepared,” and the final state could be “Tea
ready.”
NO TEA TEA
PREPARED READY
STEP 2. IDENTIFY THE INTERMEDIATE
ACTIVITIES NEEDED:
ADD TEA
LEAVES
POUR TEA
INTO CUP
STEP 3. IDENTIFY THE CONDITIONS OR
CONSTRAINTS:
No
Has the water boiled?
Yes
ADD TEA
LEAVES
POUR TEA
INTO CUP
STEP 4. DRAW THE DIAGRAM WITH
APPROPRIATE NOTATIONS:
WHAT IS A FLOW
An algorithm is like a set CHART?
of clear instructions to solve a problem,
and a flowchart is a picture that shows those instructions.
An activityWHAT
An algorithm
diagram
ARE
is like THE
a set of clear
is very
DIFFERENCES BETWEEN
instructions to
similar
AN
solve a problem, and a
to a
flowchart.
ACTIVITY
flowchart is aDIAGRAM
picture thatAND
showsAthose
FLOWCHART?
instructions.
WHAT IS A FLOW
CHART?
When we’re writing computer programs, a flowchart helps us map out
the steps of the algorithm to solve the problem.
Represents the flow of control in a system or Depicts the step-by-step flow of a process or
Purpose
process, focusing on activities and conditions. algorithm, focusing on operations.
Can represent both simple and complex Typically used for simpler, linear processes, though
Complexity
workflows, including concurrent processing. can handle limited complexity.
Uses UML symbols like initial nodes, activity Uses basic symbols like rectangles (process),
Symbols
nodes, decisions, swimlanes, etc. diamonds (decisions), and arrows (flow).
Concurrency
Supports concurrent activities and parallel Does not support parallel processes explicitly; focuses
Representatio
flows. on sequential flow.
n
DO WE NEED TO USE BOTH THE DIAGRAMS
AND THE TEXTUAL DOCUMENTATION?
Let’s understand this with the help of an example:
https://www.geeksforgeeks.org/unified-modeling-language-uml-activity-
diagrams/
https://itsourcecode.com/uml/activity-diagram-for-login-page-uml/