Visual Paradigm logo

What is Activity Diagram?

Activity diagram is another important behavioral diagram in UML diagram to describe dynamic aspects of the system. Activity diagram is essentially an advanced version of flow chart that modeling the flow from one activity to another activity.

Activity Diagram in UML Diagram Hierarchy

When to Use Activity Diagram

Activity Diagrams describe how activities are coordinated to provide a service which can be at different levels of abstraction. Typically, an event needs to be achieved by some operations, particularly where the operation is intended to achieve a number of different things that require coordination, or how the events in a single use case relate to one another, in particular, use cases where activities may overlap and require coordination. It is also suitable for modeling how a collection of use cases coordinate to represent business workflows

  1. Identify candidate use cases, through the examination of business workflows
  2. Identify pre- and post-conditions (the context) for use cases
  3. Model workflows between/within use cases
  4. Model complex workflows in operations on objects
  5. Model in detail complex activities in a high level activity Diagram

Activity Diagram - Learn by Examples

A basic activity diagram - flowchart like

Basic Activity Diagram

Activity Diagram - Modeling a Word Processor

The activity diagram example below describes the workflow for a word process to create a document through the following steps:

  • Open the word processing package.
  • Create a file.
  • Save the file under a unique name within its directory.
  • Type the document.
  • If graphics are necessary, open the graphics package, create the graphics, and paste the graphics into the document.
  • If a spreadsheet is necessary, open the spreadsheet package, create the spreadsheet, and paste the spreadsheet into the document.
  • Save the file.
  • Print a hard copy of the document.
  • Exit the word processing package.
Activity Diagram Example - Word Processor

Activity Diagram Example - Process Order

Given the problem description related to the workflow for processing an order, let's model the description in visual representation using an activity diagram:

Process Order - Problem Description

Once the order is received, the activities split into two parallel sets of activities. One side fills and sends the order while the other handles the billing.

On the Fill Order side, the method of delivery is decided conditionally. Depending on the condition either the Overnight Delivery activity or the Regular Delivery activity is performed.

Finally the parallel activities combine to close the order.

The activity diagram example below visualize the flow in graphical form.

Activity Diagram - Process Order

Activity Diagram Example - Student Enrollment

This UML activity diagram example describes a process for student enrollment in a university as follows:

  • An applicant wants to enroll in the university.
  • The applicant hands a filled out copy of Enrollment Form.
  • The registrar inspects the forms.
  • The registrar determines that the forms have been filled out properly.
  • The registrar informs student to attend in university overview presentation.
  • The registrar helps the student to enroll in seminars
  • The registrar asks the student to pay for the initial tuition.
Activity Diagram - Student Enrollment

Activity Diagram - Swinlane

A swimlane is a way to group activities performed by the same actor on an activity diagram or activity diagram or to group activities in a single thread. Here is an example of a swinlane activity diagram for modeling Staff Expenses Submission:

Activity Diagram - Use of Swimlane

Swinlane and Non-Swinlane Activity Diagram

The activity diagram example below describes the business process for meeting a new client using an activity Diagram without swinlane.

Activity Diagram (Without Swimlane)

This figure below describes the business process for meeting a new client using an activity Diagram with swinlane.

Activity Diagram (With Swimlane)

Activity Diagram Notation Summary

Notation Description UML Notation

Activity

Is used to represent a set of actions

Activity Diagram Notation - Activity

Action

A task to be performed

Activity Diagram Notation - Action

Control Flow

Shows the sequence of execution

Activity Diagram Notation - Control Flow

Object Flow

Show the flow of an object from one activity (or action) to another activity (or action).

Activity Diagram Notation - Object Flow

Initial Node

Portrays the beginning of a set of actions or activities

Activity Diagram Notation - Initial Node

Activity Final Node

Stop all control flows and object flows in an activity (or action)

Activity Diagram Notation - Activity Final Node

Object Node

Represent an object that is connected to a set of Object Flows

Activity Diagram Notation - Object Node

Decision Node

Represent a test condition to ensure that the control flow or object flow only goes down one path

Activity Diagram Notation - Decision Node

Merge Node

Bring back together different decision paths that were created using a decision-node.

Activity Diagram Notation - Merge Node

Fork Node

Split behavior into a set of parallel or concurrent flows of activities (or actions)

Activity Diagram Notation - Fork Node

Join Node

Bring back together a set of parallel or concurrent flows of activities (or actions).

Activity Diagram Notation - Join Node

Swimlane and Partition

A way to group activities performed by the same actor on an activity diagram or to group activities in a single thread

Activity Diagram Notation - Swimlane and Partition

Turn every software project into a successful one.