0% found this document useful (0 votes)
17 views17 pages

Activity diagram

Activity Diagrams are behavioral diagrams used to illustrate the flow of control in a system, focusing on the execution steps of a use case. They utilize various notations such as initial states, action states, control flows, decision nodes, and swimlanes to represent processes and decision-making paths. Commonly used in software development and business modeling, activity diagrams help visualize dynamic aspects and concurrent activities within a system.

Uploaded by

hipratikshaa13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views17 pages

Activity diagram

Activity Diagrams are behavioral diagrams used to illustrate the flow of control in a system, focusing on the execution steps of a use case. They utilize various notations such as initial states, action states, control flows, decision nodes, and swimlanes to represent processes and decision-making paths. Commonly used in software development and business modeling, activity diagrams help visualize dynamic aspects and concurrent activities within a system.

Uploaded by

hipratikshaa13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Activity Diagram

Activity Diagrams are used to illustrate the flow of control in a system and refer to the steps
involved in the execution of a use case. It is a type of behavioral diagram and we can depict both
sequential processing and concurrent processing of activities using an activity diagram ie an
activity diagram focuses on the condition of flow and the sequence in which it happens.

1. What is an Activity Diagram?


Activity Diagrams are used to illustrate the flow of control in a system and refer to the
steps involved in the execution of a use case. We can depict both sequential
processing and concurrent processing of activities using an activity diagram ie an
activity diagram focuses on the condition of flow and the sequence in which it
happens.
● We describe what causes a particular event using an activity diagram.
● An activity diagram portrays the control flow from a start point to a finish
point showing the various decision paths that exist while the activity is
being executed.
● They are used in business and process modeling where their primary use is
to depict the dynamic aspects of a system.

2. Activity Diagram Notations


In activity diagrams, the notations are like visual symbols that help represent different
elements and actions in a simple way.

2.1. Initial State

The starting state before an activity takes place is depicted using the initial state.

A process can have only one initial state unless we are depicting nested activities. We
use a black filled circle to depict the initial state of a system. For objects, this is the
state when they are instantiated. The Initial State from the UML Activity Diagram
marks the entry point and the initial Activity State.
For example:
Here the initial state of the system before the application is opened.
2.2. Action or Activity State

An activity represents execution of an action on objects or by objects. We represent an


activity using a rectangle with rounded corners. Basically any action or event that
takes place is represented using an activity.

For example:
Consider the previous example of opening an application, opening the application is
an activity state in the activity diagram.

2.3. 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 activity state.
An activity state can have multiple incoming and outgoing action flows. We use a line
with an arrow head to depict a Control Flow. If there is a constraint to be adhered to
while making the transition it is mentioned on the arrow.
For example:
Here both the states transit into one final state using action flow symbols i.e. arrows.

2.4. Decision node and Branching

When we need to make a decision before deciding 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.
For example:
We apply the conditions on input number to display the result :

● If number is odd then display the number.


● If number if even then display the error.
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:
When both activities i.e. steaming the milk and adding coffee get completed, we
converge them into one final activity.
2.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. We can merge two or more
activities into one if the control proceeds onto the next activity irrespective of the path
chosen.

For 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.
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:
Here different set of activities are executed based on if the number is odd or even.
These activities are grouped into a swimlane.
2.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 completed.

For example:
Let us assume that the processing of an image takes a lot of time. Then it can be
represented as shown below.
2.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. 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.
What are Activity Diagrams used for?
Activity diagrams are used in software development and system design to model and
visualize the dynamic aspects of a system. Here are some common uses of activity
diagrams:
● Dynamic modelling of the system or a process.
● Illustrate the various steps involved in a UML use case.
● Model software elements like methods,operations and functions.
● We can use Activity diagrams to depict concurrent activities easily.
● Show the constraints, conditions and logic behind algorithms.
● During the requirements analysis phase, activity diagrams assist in capturing
and documenting the dynamic aspects of user interactions.

What is a Flow Chart?

An algorithm is like a set of clear instructions to solve a problem, and a flowchart is a


picture that shows those instructions.
● When we’re writing computer programs, a flowchart helps us map out the
steps of the algorithm to solve the problem.
● Non programmers use Flow charts to model workflows.
● We can call a flowchart a primitive version of an activity diagram.
● Business processes where decision making is involved is expressed using a
flow chart.

Example:
A manufacturer uses a flow chart to explain and illustrate how a particular product is
manufactured.

Activity Diagram - Modeling a Word Processor


Activity Diagram Example - Process Order

You might also like