Purpose
An activity diagram (AD) describes processes that involve
more than one object. They are useful for showing workflow
and parallel processing.
Compared with statechart diagram
Statechart and activity diagrams both describe state
transitions and share many of the same elements. A statechart
diagram is useful for describing the behavior of a single
object across several use cases.
Example activity diagram
A sample activity diagram.
Control panel
The control panel of the activity diagram.
States
Action state
An action state represents an activity. If necessary,
you can use another activity diagram to provide details
about the activity; that is, you can use activity diagrams
to decompose action states.
An action state corresponds to an STDs state with internal
actions when the state with internal actions has at
least one outgoing transition that occurs when the internal
action completes.
Label
activity [(parameter[,parameter...])]
Start state
The start state begins the sequence of activities.
It is the same as the initial state in an STD.
Label
name
Final state
The final state ends the sequence of activities. It
is the same as the final state in an STD.
Label
name[(parameter[,parameter...])]
Transitions
Transition
Transitions (solid arrows) order the sequence of activities.
Completing an activity fires the outgoing transitions
of the action state representing the activity.
An action state must have at least one outgoing transition.
If an action state has more than one outgoing transition,
each must have a guard condition.
Label
See
Events and Transitions.
Complex transition
A complex transition (a thick line) synchronizes activities.
The AD shown previously (see
Example activity diagram) includes a number of complex
transitions:
- After the Choose Dinner activity completes, two
activities occur: Find Recipe and Set Table. The complex
transition indicates that these two activities can
occur in any order.
- The next complex transition in the AD indicates
that the Eat activity does not begin until after both
the Cook and Set Table activities are complete.
Label
Same as for a
Transition.
Decision
You can use a decision diamond to express nested decisions.
In the AD shown previously (see
Example activity diagram), the two outgoing transitions
of the Choose Dinner activity reflect a decision about
whether to eat in. The [do not eat in] transition leads
to a second decision, represented by the decision diamond,
about whether to eat out.
Label
No label.
Objects, Object Flows, and Signals
Object in state
An object in state represents instances of a specified
object in a specified state. You must specify the object
name. The state name is optional; if specified, the
UML suite automatically encloses it in square brackets.
Folding an object hides its state name.
Label
object-name [state-name]
Object flow
You use object flows (dashed arrows) to show how objects
in state are used by action states and transitions.
If an action state generates an object in state that
is used by the subsequent action state, you can omit
the transition (solid arrow) between the two states.
Label
No label.
Example of objects in state and object flows
In this example, completing the Take Order activity,
creates an Order in the [entered] state. The Fill Order
activity requires an Order in the [entered] state and
creates an Order in the [filled] state.
Signal sending
A signal sending symbol shows a transition sending
a signal. Do not label transitions connected to a signal
sending symbol. Optionally, use an object flow to indicate
the object that receives the signal.
Label
[(parameter[,parameter...])]
Signal receipt
A signal receipt symbol shows a transition receiving
a signal. Do not label transitions connected to a signal
receipt symbol. Optionally, use an object flow to indicate
the object that sends the signal.
Label
[(parameter[,parameter...])]
Example of signal sending and receipt
In this example, the transition from Take Order to
Fill Order sends an enterOrder signal to the Order object.
The transition from Fill Order to Deliver Order receives
an orderFilled signal from the Order object.
Partitions and Swimlanes
Partitions
You use partitions to group the states of an activity
model. Typically, each partition corresponds to an organizational
unit in a business model. You can use partitions to
allocate characteristics or resources among the states
of an activity model.
Label
No label.
Swimlane separator
You use swimlane separators to divide a partition into
horizontal or vertical zones called swimlanes. A partition
with no swimlane separators contains one swimlane.
Label
You label each swimlane with the name of the class
or department responsible for the activity states in
the swimlane.
Example
To create the two swimlanes, use a partition and a
horizontal or vertical swimlane separator.
|