State and activity diagrams

Instructor's Guide

introduction class diagrams use cases interaction packages state and activity discussion
The characterization of behavior given by interaction diagrams primarily concerns, as the name says, the interaction between objects. The dynamic behavior of the objects themselves and the global activity can only be inferred from such diagrams.

An explicit characterization of the dynamic behavior of an individual object may be given by a state transition diagram.

slide: State diagrams

A state transition diagram consists of states and transitions between states, indicated by arrows. The arrows may be indicated by expressions of the form

indicating that a transition can take place when a particular event occurs and certain conditions are satisfied. The transition will then result in an action, which may possibly modify state/instance variables.

Individual states may contain the specification of actions in response to particular events and the entry and exit of the state. States may be grouped to form a single (super)state, such as state-0 in the diagram on the left in slide uml-state.

To characterize the overall activity of a system, or parts thereof, activity diagrams may be used. Activity diagrams consist of nodes indicating activities.

Since activity diagrams are rather unspecific with respect to the actual objects involved, such diagrams are most appropriate in analysing aspects of workflow. In contrast, state diagrams are usually tied to the implementation of objects, such as event-schedulers, with complex dynamic behavior.

Both state diagrams and activity diagrams allow for parallelism. In activity diagrams, parallel activity may be assigned to so-called swim-lanes, activity falling under the responsibility of a particular role, an actor or a part of the system.