Introduction
State Machines
State machines indicate the sequences of states an object undergoes in response to events throughout its lifetime
State machines are used to model
- the behavior of an individual object
- the dynamic aspects of a system
State machines can visualize by,
- highlighting the flow control from activity to activity
- highlighting the potential states of objects and the transition among those states
Statechart Diagram
- Shows a state machine, emphasizing the flow of control from state to state
- Statechart diagram is used to model
dynamic aspects of a system
the behavior of reactive objects
- Important for constructing executable systems through forward and reverse engineering
A state machine refers to a behavior that recognizes the sequence of states an object undergoes in response to events throughout its lifetime.
A state refers to a situation of an object, where it satisfies some conditions, carries out some activity, or waits for some event.
Name
- A textual string
Entry/Exit actions
- Actions executed on entering and exiting the state
Internal transitions
- Transitions that are handled without causing a change in state
Substates
- The nested structure of a state
Deferred events
- A list of events that are not handled in that state, but are postponed and queued for handling by the object in another state
Initial and final states
- Initial state shows the beginning of the state machine and final state shows the ending of the state machine
Transitions
- A transition is a relationship between two states
- An object performs certain actions in the first state. It then enters the second state when specified events happen and specified conditions are satisfied
The parts of transition are:
Source state: State affected by transition
Event trigger: Event whose reception by the object in the source state makes the transition eligible to fire
Guard condition: A Boolean expression that is evaluated when the transition is triggered by the reception of event trigger
Effect: It is a behavior which executes when a transition fires
Action: State that is active after the completion of transition
Target state: An executable atomic computation