Topic: State Machine View

Total Page:16

File Type:pdf, Size:1020Kb

Topic: State Machine View

CHAPTER 6

Topic: State Machine view

After reading this Chapter, students should appreciate the following:

 Understand the concepts of state Machine.

Instructor Notes

The state machine view describes the dynamic behavior of objects over time by modeling the lifecycles of objects of each class.

State Machine

- A state machine is a graph of states ad transitions. - A state machine is attached to a class and describes the response of an instance of the class to events that it receives. - State machines may also be attached to operations, use cases and collaborations to describe their execution. - It is a model of all possible life histories of an object of a class.

Event

- An event is a noteworthy occurrence that has a location in time and space. - It occurs at a point in time, it does not have duration. - A specific occurrence of an event is called as an event instance. - Events can be divided into various explicit and implicit kinds : o Signal event: a named entity that is explicitly intended as a communication vehicle between two objects. o Call event: is the reception of a call by an object that chooses to implement an operation as a state machine transition rather than as a fixed procedure. o Change event: is the satisfaction of a Boolean expression that depends on certain attribute values. o Time events: represents the passage of time. A time event can be specified either in absolute mode or relative mode.

State

- A state describes period of a time during the life of an object of a class. - It can be characterized in three complementary ways: o As a set of object values that are qualitatively similar in some respect o As a period of time during which an object waits for some event or events to occur o As a period of time during which an object performs some ongoing activity. o Transitions connect two states. Transitions are processed by the state they leave.

Transition

- A transition leaving a state defines the response of an object in the state to the occurrence of an event. - Transition has an event trigger, a guard condition, an action and a target state.

Types of Transitions:

- External Transition: An external transition is a transition that changes the active state. - Trigger Event: is an event occurrence of which enables the transition. - Guard Condition: A transition may have a guard condition, which is a Boolean expression. The guard condition is evaluated when a trigger event occurs. - Complete transition: A transition that lacks an explicit trigger event is triggered by completion of activity in the state that it leaves. - Action: When a transition fires, its action is executed. (Please refer to Table 6.3 on page 74 for types of action description) - Change of State: When the execution of the action is complete, the target state of the transition becomes active. - Nested States: States may be nested inside other composite states. Composite states are useful for expressing exception and error conditions, because transitions on tem apply to all nested states without need for each nested state to handle the exception explicitly. - Entry and exit actions: A transition across one or more levels of nesting may exit and enter states. - Internal transition: An internal transition has a source state but no target state. Internal transitions are useful for modeling interrupt actions that do not change the state. Composite States:

- A composite state is one that has been decomposed into sequential substates of concurrent substates. - A decomposition into concurrent substates represents independent computation.

Figure 6.5 on page 77 shows a sequential decomposition of a state, including an initial state.

Recommended publications