UML Guide v2.1
Author: Rajinder Yadav
Date: Nov 18, 2007
Activity Diagram
The Activity Diagram is a variation of the State Machine diagram, it is used to display the flow of actions for an implementation of a method or process such as in a Use Case. The execution stages are shown as a sequence of activity nodes drawn in linear manner, each activity can have one or more action assigned to it.
A UML activity element is represented like a UML state element, inside a round rectangle. The activity is what takes place at the conceptual level, the activity label should be short yet descriptive enough to convey what is occurring that a particular stage.
 Diagram 1 - Activity Diagram
The initial activity is shown with a dot pointing to an activity node. It helps to be able to locate the initial activity in the diagram. However the initial dot can be omitted from the diagram. The final activity is shown by a circle with a dot inside, there can be several final nodes, which are arrived at by the various path of execution.
Directed arrows are used to display the flow from one activity to the next.
Conditions
Execution flow will sometimes have Guards that are used to control the next activity to traverse. Guards are used to label a path, the condition is placed inside a pair of square brackets, such as "[condition]". Only when the condition of a Guard is satisfied can the execution flow to the next action. In the following diagram, only when the, "end of file" is read does the action to close the file takes place.
 Diagram 2 - Activity Guard
When there are multiple Guards, the conditions must be exclusive. Once a condition is met the execution moves to the next activity node for the satisfied path. It is a good idea to draw guarded activities in parallel as illustrated below.
 Diagram 3 - Activity Conditions
Another way to show conditional branching is by using a decision node as the next diagram shows.
 Diagram 4 - Activity Decision Node
Copyright © 2007 Rajinder Yadav, All rights reserved
UML logo are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries
|