03 UML-Activity Diagram
03 UML-Activity Diagram
1
Activity Diagram(Cont.)
• Activity is a particular operation of the system. Activity
diagrams are not only used for visualizing the dynamic nature
of a system, but they are also used to construct the executable
system by using forward and reverse engineering techniques.
The only missing thing in the activity diagram is the message
part.
• It does not show any message flow from one activity to
another. Although the diagrams look like a flowchart, they are
not. It shows different flows such as parallel, branched,
concurrent, and single.
• The purpose of an activity diagram can be described as −
• Draw the activity flow of a system.
• Describe the sequence from one activity to another.
2
Activity Diagram (Cont.)
• 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
3
Activity Diagram V.s UseCase
(Cont.)
• An activity diagram is used to model the workflow depicting conditions,
constraints, sequential and concurrent activities.
• On the other hand, the purpose of a Use Case is to just depict the
functionality i.e. what the system does and not how it is done.
• So in simple terms, an activity diagram shows ‘How’ while a Use case
shows ‘What’ for a particular system.
• The levels of abstraction also vary for both of them. An activity diagram
can be used to illustrate a business process (high level implementation) to
a stand alone algorithm (ground level implementation).
• However, Use cases have a low level of abstraction. They are used to show
a high level of implementation only.
4
5
ATM –Pin Verification
6
Emotio
n
Based
Music
Player
7
Coffee
Machine
8
Passenger
boarding
9
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 10
Modeling a Word Processor
11
Order Management System
• 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.
12
13