IBM
Contents Index Previous Next



State Chart Notation


The notation presented in this section is a subset of the notation for state charts presented by David Harel [36] which is used in the Unified Modeling Language (UML) [37] as well as in the Object Modeling Technique (OMT) [21].

A state chart model is suitable to use together with class and object models. The descriptions of the behavior of a class in a class diagram is collected into a state chart which describes the dynamic view of the model by means of states and transitions. The notation to use is presented below.

Notation

State

To describe state charts a state symbol is needed. The state symbol is divided into three compartments, State Name, State Variable and Internal Activity, which are all optional. The top compartment contains the optional name of the state. State symbols with the same name within the same context are considered to be the same. It is not necessary to name states and if several anonymous states exists; each anonymous state symbol is considered to be an individual state. Figure 623 shows a collapsed state and a state with events.

Figure 623 : A collapsed state symbol and a state symbol
with events

A state symbol may contain an Internal Activity compartment which describes the activities of the current state, activities that are done upon entering the state, activities taking place while in the state and activities executed when exiting the state. Each activity is described in the format:

event-name argument-list `/' action expression

Each event name may appear only once within a state symbol. The event names "entry", "exit" and "do" are reserved and they describe the following actions:

`entry' `/' action expression
An atomic action performed upon entering the state
`exit' `/' action expression
An atomic action performed upon exiting the state
`do' `/' action expression
An action performed during the state

Transition

The second necessary symbol for drawing state charts is the transition. The transition symbol is an arrow which connects two symbols of either type of state, start and termination, see Figure 624.

Figure 624 : The transition from state1 to state2 is triggered by the event
my_event and the condition that attr1 is less than attr2

The syntax for the transition symbol follows the format:

event-signature `[` guard-condition']` `/' action-expression `output' send-clause

The event-signature consists of the parts:

event-name `(` parameter `,' ... `)'

The guard-condition is a Boolean expression formed by the parameters of the triggering event together with possible attributes and links of the object described by the state chart.

The action-expression describes the action that is executed during the transition. The action may be described by procedures, affected attributes and links.

The send-clause has the format:

destination-expression `.' Destination-event-name `(` argument `.' ...')'

The destination-expression identifies the receiving object or a set of receiving objects.

The Destination-event-name is the name of an event that may be received by the receiving object(s).

Start and Termination Symbol

The start symbol denotes the starting point of a state machine described by a state chart and the termination symbol denotes the point of termination of a state machine. Figure 625 shows a simple state machine, describing the behavior of a door, including a start symbol and a termination symbol.

Figure 625 : A simple state chart with a start symbol and a termination symbol

Substates

States may be refined into nested diagrams of sub-states, or hierarchical states. The state represents a simplification of more complex behavior expressed in the nested diagram.

Figure 626 : A state chart with states and substates.

State Charts in SOMT

State Charts and SDL

Both State Charts and SDL process graphs are two notations used to express state machines. The two notations have both their advantages. State Charts are good for expressing high level functionality typically used in early activities like analysis. SDL is good for expressing detailed functionality as in design activities. SDL is also a formal notation, with well defined semantics, from which it is possible to generate code.

State Charts in Requirements Analysis

State charts might be used to express high level functionality of a system by focusing on the behavior of the system rather than the behavior of the system's parts. It might also be useful to express the behavior of complex actors that are interacting with the system.

State Charts in System Analysis

In the context of system analysis, state charts are useful to express the behavior of the system parts and how these parts interact dynamically. The architecture of the system is described in a class diagram named Logical Architecture. Using state charts in addition to the class diagram makes it possible to describe the dynamic properties and the behavior of the system or parts of the system. The behavior descriptions should be included in a set of documents called the Object Behavior Diagram which together with the Logical Architecture is part if the Analysis Object Model.

State Charts in System and Object Design

During the activities of System and Object Design, SDL process diagram is the preferred notation for describing the behavior of the system. The product of the Object Design activity should be a complete description of the system which enables code generation. State Charts, due to their weak semantics, may be useful to express a less detailed overview of rather complex behavior expressed in SDL.


http://www.ibm.com/rational
Contents Index Previous Next