Lecture 09
Lecture 09
Activity Diagram
1
Todays’ Lecture
• What is Activity Diagram?
• Objectives of Activity Diagram
• Where to use Activity Diagram?
• When to use Activity Diagram?
• Notations Summary
• Drawing an Activity Diagram
• Elements of an Activity Diagram
• Activity Diagrams Examples
• Activity Diagrams with Swimlanes 2
Activity Diagram
• Activity diagram is another important diagram in UML to
describe dynamic aspects of the system.
• Activity diagram is essentially an advanced version of flow chart
that models the flow from one activity to another activity.
• The activity can be described as an operation of the system.
• The control flow is drawn from one operation to another.
• This flow can be sequential, branched, or concurrent.
• Activity diagrams deal with all type of flow control by using
different elements such as fork, join, etc.
3
Objectives of Activity Diagram
• It captures the dynamic behavior of the system.
• Activity diagram is used to show message flow
from one activity to another.
• Activity is a specific operation of the system.
• It does not show any message flow from one
activity to another.
4
Where to use Activity Diagrams?
• The usage of activity diagram is to model the control flow
from one activity to another.
• This control flow does not include messages.
• Activity diagram is suitable for modeling the activity
flow of the system.
• An application can have multiple systems.
• Activity diagram also captures these systems and
describes the flow from one system to another.
• These systems can be database, external queues, or any
other system.
5
Where to use Activity Diagrams?
• An activity diagram is drawn from a very high level.
• It gives high level view of a system.
• This high level view is mainly for business users or any
other person who is not a technical person.
• This diagram is used to model the activities which are
business requirements.
• The diagram has more impact on business understanding
rather than on implementation details.
6
Where to use Activity Diagrams?
• Activity diagram can be used for
• Modeling work flow by using activities.
• Modeling business requirements.
• High level understanding of the system's
functionalities.
• Investigating business requirements at a later stage.
7
When to use Activity Diagrams?
• 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 8
Drawing an Activity Diagram
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
9
Elements of an 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 10
How to Draw an Activity Diagram?
• Once the above-mentioned parameters are
identified, we need to make a intellectual layout
of the entire flow.
• This layout is then transformed into an activity
diagram.
11
Notations Summary
Activity Represents a set of actions
12
Notations Summary
Represent a test condition to
Decision
ensure that the flow goes
Node
down one path
Bring back different paths
Merge
that were created using
Node
decision node
Split behavior into a set of
Fork Node
parallel activities
14
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. 15
• Exit the word processing package
Activity
Diagram -
Modeling
a
Word
Processor
16
Activity Diagram Example - Process Order
• Given the problem description related to the workflow
for processing an order, let's model using an activity
diagram:
• 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.
17
Activity
Diagram
Example
-
Process
Order
18
Activity Diagram – 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. 19
Activity Diagram – Student Enrollment
20
Swimlane
• 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 swimlane activity
diagram for modeling Staff Expenses
Submission:
21
Swimlane Activity Diagram - Staff Expenses Submission
22
Meeting
Client:
Non-
Swimlane
Activity
Diagram
23
Meeting
Client:
Swimlane
Activity
Diagram
24
End of Lecture
25