contents   previous




D. State diagrams

State diagrams can also be useful during analysis as well as design activities. Such diagrams are typically used to exhibit detailed behavior in objects in a manner similar to the way that activity diagrams were used for use cases. In fact the two types of diagrams share similar features. The "activity" boxes in activity diagrams are replaced by boxes for "states". An object is considered to be in one of these states at any given time.

Each state typically involves certain duties (activities). Sometimes these are of sufficient complexity to warrant representing the state by means of another state diagram. This can be drawn inside the original state.

A state box generally has a title and may also have a list of duties following prefixes like do/, entry/ (duties to be performed upon entering the state), exit (duties to be performed upon exit from the state). Transitions arrows between states can be labeled with guards (as in activity diagrams), as well as with labels of the form event/action or just event or just /action. Here "event" is something causing the transition and "action" is something that happens as a result of the transition.

Most, but not all, of these features are illustrated in the next example.



next