An activity diagram is a variation of a State Machine. In the State Machine, the States represent the performance of Actions or subactivities, while the Transitions are triggered by the completion of the Actions or subactivities. It represents a State Machine of a procedure itself. The entire Activity diagram is attached through the model to a Class (such as a Use Case), to a Package, or to the implementation of an Operation. The purpose of this diagram is to focus on flows driven by the internal processing as opposed to external events. Use the Activity diagrams in situations in which all or most of the events represent the completion of internally-generated actions, i.e. procedural flow of control. Use the ordinary State diagrams in situations in which asynchronous events occur. An Activity diagram is a variant of a State diagram. Organized according to Actions, the Activity diagrams mainly depict the internal behavior of a method, i.e. the implementation of an Operation, or a Use Case.
Though Activity diagrams are often associated with interaction diagrams, they focus more on the work performed by a system, instead of an object interaction. An Activity diagram captures Actions and displays their results.
A State diagram may also represent this sequencing of steps. However, given the procedural nature of the implementation of the operations in which most events simply correspond to the end of the preceding activity, it is not necessary to distinguish States, activities, and Events systematically, e.g. a State change and external events are less important inside the method. Therefore, it is beneficial to have a simplified representation for directly displaying activities.
The Activity diagram provides a convenient way to describe complex algorithms, parallel operations, and business processes. Together with the Communication and Sequence diagrams, they are used to relate Use Cases.
The following functionalities help you work in an Activity diagram:
To turn on the Automatic Behavior Creation mode in an Activity diagram
When the Automatic Behavior Creation mode is on:
The centerlines are displayed only when the center of the shape that was moved or newly drawn is located near the center of a pre-existing shape in the diagram. These lines help you to easily align shapes when drawing a diagram.
When the center of the shape that was moved coincides with a center of any shape that is placed to its right or left, a horizontal centerline appears. When the center of the shape is close to any center of a shape that is located above or below it, a vertical centerline appears.
To switch off the dynamic centerlines
The diagram orientation is used to assign the correct rectilinear path breaks and draw paths between the Activity diagram shapes. The paths can be drawn from side to side, or from the lower to the upper shape borders.
If you have a vertical diagram orientation and shapes are not in the same centerline, the paths will be connected from the lower border of the first shape to the upper border of the next shape, adding break points:
To change the diagram orientation
This is valid if the assigned Behavior is editable and does not have more usages, i.e. there is not a Call Behavior Action that has a reference to this Behavior.
To display inner elements
When creating a new Activity diagram, right-click an Activity in the Containment tree, point to Create Diagram, and then click Activity Diagram.
Inner elements are displayed on the Activity diagram pane automatically upon creating the first diagram under the Activity element.