29.2. Statechart Diagrams

A UML statechart diagram, as shown in Figure 29.1, illustrates the interesting events and states of an object, and the behavior of an object in reaction to an event. Transitions are shown as arrows, labeled with their event. States are shown in rounded rectangles. It is common to include an initial pseudo-state, which automatically transitions to another state when the instance is created.

Figure 29.1. Statechart diagram for a telephone.


A statechart diagram shows the lifecycle of an object: what events it experiences, its transitions, and the states it is in between these events. It need not illustrate every possible event; if an event arises that is not represented in the diagram, the event is ignored as far as the statechart diagram is concerned. Therefore, we can create a statechart diagram that describes the lifecycle of an object at arbitrarily simple or complex levels of detail, depending on our needs.

Subject of a Statechart Diagram

A statechart diagram may be applied to a variety of UML elements, including:

  • classes (conceptual or software)

  • use cases

Since an entire “system” may be represented by a class, it too may have its own statechart diagram.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.139.105