Designing activity diagrams
UML activity diagrams specify a workflow, or process, for classes, use cases, and operations. As opposed to statecharts, activity diagrams are preferable when behavior is not event driven.
A class use case or operation can have either an activity diagram or a statechart, but not both. A class, object, block, part, or use case can have more than one activity diagram with one of the diagrams designated as the main behavior.
One useful application of activity diagrams is in the definition of algorithms. Algorithms are essentially decompositions of functions into smaller functions that specify the activities encompassed within a given process.
UML activity diagrams have the following features:
- Decision nodes show branching points in the program flow based on guard conditions.
- Actions represent function invocations with a single exit control flow taken when the function completes. It is not necessary for all actions to be within the same object.
- Accept Event Actions represent that the process is waiting for event to occur.
- Action blocks represent compound actions that can be decomposed into actions.
- Subactivities represent nested activity diagrams.
- Object nodes represent an object passed from the output of the action for one state to the input of the actions for another state.
- Swimlanes visually organize responsibility for actions and subactions. They often correspond to organizational units in a business model.
- Call behaviors reference activities in another activity chart or to the entire activity chart itself.
- Call Operation references operations in another activity chart or to the entire activity chart itself.
- Analysis mode uses pins, parameters, flow finals, and interruptible regions.
You might also use these advanced features of the activity diagrams:
- Naming and renaming activity diagrams
- Include an activity diagram, but not a statechart, with a package without creating a class
- Support multiple activities in a package
- Adding call behaviors in the activity diagram or by dropping an operation from the browser into the diagram
- Swimlane association (representing field population) to a class (only) can be created by dragging the class from the browser to the Swimlane name compartment. For more information, see Dividing activity diagrams by using swimlanes.
- Reference an alternate activity diagram within the main behavior activity diagram