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.
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
Identify candidate use cases, through the examination of business workflows
Identify pre- and post-conditions (the context) for use cases
Model workflows between/within use cases
Model complex workflows in operations on objects
Model in detail complex activities in a high level activity Diagram
Activity Diagram - Learn by Examples
A basic activity diagram - flowchart like
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 - 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 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 - 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:
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.
This figure below describes the business process for meeting a new client using an activity Diagram with swinlane.
Activity Diagram Notation Summary
Is used to represent a set of actions
A task to be performed
Shows the sequence of execution
Show the flow of an object from one activity (or action) to another activity (or action).
Portrays the beginning of a set of actions or activities
Activity Final Node
Stop all control flows and object flows in an activity (or action)
Represent an object that is connected to a set of Object Flows
Represent a test condition to ensure that the control flow or object flow only goes down one path
Bring back together different decision paths that were created using a decision-node.
Split behavior into a set of parallel or concurrent flows of activities (or actions)
Bring back together a set of parallel or concurrent flows of activities (or actions).
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