Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

What is an activity diagram?

The Unified Modeling Language includes several subsets of diagrams, including structure
diagrams, interaction diagrams, and behavior diagrams. Activity diagrams, along with use
case and state machine diagrams, are considered behavior diagrams because they describe what
must happen in the system being modeled.
It captures the dynamic behavior of the system. Other four diagrams are used to show the
message flow from one object to another but activity diagram is used to show message flow
from one activity to another.
Stakeholders have many issues to manage, so it's important to communicate with clarity and
brevity. Activity diagrams help people on the business and development sides of an organization
come together to understand the same process and behavior. You'll use a set of specialized
symbols—including those used for starting, ending, merging, or receiving steps in the flow—to
make an activity diagram, which we’ll cover in more depth within this activity diagram guide.
Benefits of activity diagrams

Activity diagrams present a number of benefits to users. Consider creating an activity diagram
to:
• Demonstrate the logic of an algorithm.
• Describe the steps performed in a UML use case.
• Illustrate a business process or workflow between users and the system.
• Simplify and improve any process by clarifying complicated use cases.
• Model software architecture elements, such as method, function, and operation.

Basic components of an activity diagram

Before drawing an activity diagram, we must have a clear understanding about the elements used
in activity diagram. The main element of an activity diagram is the activity itself. An activity is a
function performed by the system. After identifying the activities, we need to understand how they
are associated with constraints and conditions.
Before drawing an activity diagram, we should identify the following elements −
• Activities
• Association
• Conditions
• Constraints
Once the above-mentioned parameters are identified, we need to make a mental layout of the entire
flow. This mental layout is then transformed into an activity diagram.
Some of the most common components of an activity diagram include:
• Action: A step in the activity wherein the users or software perform a given task.
• Decision node: A conditional branch in the flow that is represented by a diamond. It includes a
single input and two or more outputs.
• Control flows: Another name for the connectors that show the flow between steps in the
diagram.
• Start node: Symbolizes the beginning of the activity. The start node is represented by a black
circle.
• End node: Represents the final step in the activity. The end node is represented by an outlined
black circle.

Create a UML Diagram

Activity diagram symbols

These activity diagram shapes and symbols are some of the most common types you'll find in
UML diagrams.

Symbol Name Description

Represents the
beginning of a
process or workflow
in an activity
Start symbol diagram. It can be
used by itself or with
a note symbol that
explains the starting
point.

Indicates the activities


that make up a
modeled process.
Activity symbol These symbols, which
include short
descriptions within
the shape, are the
Symbol Name Description

main building blocks


of an activity
diagram.

Shows the directional


flow, or control flow,
of the activity. An
incoming arrow starts
Connector
a step of an activity;
symbol
once the step is
completed, the flow
continues with the
outgoing arrow.

Combines two
concurrent activities
and re-introduces
Joint symbol/ them to a flow where
Synchronization only one activity
bar occurs at a time.
Represented with a
thick vertical or
horizontal line.

Splits a single activity


flow into two
concurrent
Fork symbol
activities. Symbolized
with multiple arrowed
lines from a join.

Represents a decision
and always has at
least two paths
branching out with
Decision condition text to
symbol allow users to view
options. This symbol
represents the
branching or merging
of various flows with
Symbol Name Description

the symbol acting as a


frame or container.

Allows the diagram


creators or
collaborators to
communicate
additional messages
Note symbol
that don't fit within
the diagram itself.
Leave notes for added
clarity and
specification.

Indicates that a signal


Send signal
is being sent to a
symbol
receiving activity.

Demonstrates the
acceptance of an
Receive signal event. After the event
symbol is received, the flow
that comes from this
action is completed.

Shallow history Represents a


pseudo state transition that invokes
symbol the last active state.

Allows the creator to


Option loop model a repetitive
symbol sequence within the
option loop symbol.

Represents the end of


a specific
process flow. This
Flow final symbol shouldn’t
symbol represent the end of
all flows in an
activity; in that
instance, you would
Symbol Name Description

use the end symbol.


The flow final symbol
should be placed at
the end of a process in
a single activity flow.

Placed next to a
decision marker to let
you know under what
Condition text
condition an activity
flow should split off
in that direction.

Marks the end state of


an activity and
represents the
End symbol
completion of all
flows of a process.

How to Draw an Activity Diagram


Activity diagrams can be used to model business requirements, create a high-level view of a
system’s functionalities, analyze use cases, and for various other purposes. In each of these
cases, here’s how to draw an activity diagram from the beginning.

Step 1: Figure out the action steps from the use case
Here you need to identify the various activities and actions your business process or system is
made up of.

Step 2: Identify the actors who are involved


If you already have figured out who the actors are, then it’s easier to discern each action they are
responsible for.

Step 3: Find a flow among the activities


Figure out in which order the actions are processed. Mark down the conditions that have to be
met in order to carry out certain processes, which actions occur at the same time and whether you
need to add any branches in the diagram. And do you have to complete some actions before you
can proceed to others?

Step 4: Add swimlanes


You have already figured out who is responsible for each action. Now it’s time to assign them a
swimlane and group each action they are responsible for under them.

________________________________________________________________

Activity diagram examples

Activity diagrams map out process flows in a way that's easy to understand. Consider the two
examples below when it comes to creating UML activity diagrams.

Structure of the Activity Diagram :


For example, below is an Activity Diagram for Reserving a Ticket.

Essential key-points of all the above diagrams :


• Fork –
It is used to represent the multiple parallel flows.
• Branches –
It allow the parallel flow within activities.
• Merge –
It brings together or combines together multiple branches.
• Join –
It is used to control and synchronize various parallel flows.

Activity diagram for a login page


Many of the activities people want to accomplish online—checking email, managing finances,
ordering clothes, etc.—require them to log into a website. This activity diagram shows the
process of logging into a website, from entering a username and password to successfully
logging in to the system. It uses different container shapes for activities, decisions, and notes.
Following is an example of an activity diagram for order management system. In the diagram, four
activities are identified which are associated with conditions. One important point should be
clearly understood that an activity diagram cannot be exactly matched with the code. The activity
diagram is made to understand the flow of activities and is mainly used by the business users
Following diagram is drawn with the four main activities −
• Send order by the customer
• Receipt of the order
• Confirm the order
• Dispatch the order
After receiving the order request, condition checks are performed to check if it is normal or special
order. After the type of order is identified, dispatch activity is performed and that is marked as the
termination of the process.

Activity diagram for issue book in Library management System


Activity Diagrams with Swimlanes
In activity diagrams, swimlanes – also known as partitions – are used to represent or group
actions carried out by different actors in a single thread. Here are a few tips you can follow when
using swimlanes.

• Add swimlanes to linear processes. It makes it easy to read.


• Don’t add more than 5 swimlanes.
• Arrange swimlanes in a logical manner.

Swimlane diagrams are also known as the Rummler-Brache diagram or a cross-functional


diagram. Swimlanes are sometimes called functional bands. It simply describes who is
responsible for the activities being performed in the activity diagram and how they are
responsible. The activity diagram only represents the activities being performed, but Swimlane
describes who does what in a process or activity performed.

In the Swimlane diagram, the activity diagram is divided according to the class responsible for
working or performing out these activities. It simply shows the connection and strong
communication between these lanes and is used to highlight waste, redundancy, and
inefficiency in a process of an activity or program.
For example, below is a Swimlane diagram for reserving a ticket.
FAQ:

1. What are the benefits of activity diagrams?


Activity diagrams are useful in a number of scenarios.

• An activity diagram provides a clear and easy-to-understand pictorial


representation of how the software system will function.
• Provides a high-level overview of a system’s functionality which any non-
technical person can quickly understand.
• Activity diagrams help effectively document and visualize the exact process
and steps involved in the developmental process.
• They have different uses for all phases of a software development project.
During the planning stage activity diagrams can be used to visualize the
workflows within a system, while during the requirements gathering stage they
can be used for representing the different use cases of a system.
• Activity diagrams can also be used to understand the requirements of business
processes more effectively.

2. What are the basic components of an activity diagram?


Activity diagrams involve multiple components or notations. Some of the most
common components include activities, actions, control nodes, object nodes,
decision nodes, and activity edges.

3. What are activity diagrams used for and when to use them?
Activity diagrams are used in software modeling as well as business modeling.
Most commonly activity diagrams are used to;

• Capture the dynamic behavior of a system, application, or process.


• Create a high-level overview of the workflow of any application or system.
• Visualize the flow of events that a UML use case describes.
• Model various software elements such as method, function, and operation.
• Highlights the multiple conditions and actors within a workflow through the
use of swimlanes.

4. What is the difference between activity diagrams vs flowcharts?


Activity diagrams represent the flow of activities within a system and depict the
workflow/ interaction between these various system activities. Flowcharts, on the
other hand, represent the sequence of steps in an event, process, or system. While
they look similar, activity diagrams are more advanced as they possess unique
capabilities that flowcharts lack. Activity diagrams contain unique elements such
as branching, parallel flow, control nodes, expansion nodes, swimlanes, and object
nodes.

You might also like