- State machine or behavioral state machine is a specialization of behavior and is used to specify discrete behavior of a part of the designed system through finite state transitions.
- Behavior is modeled as a traversal of a graph of state nodes connected with transitions.
- Transitions are triggered by the dispatching of series of events.
- During the traversal, the state machine could also execute some activities.
- Behavioral state machine could be owned by "behaviored classifier" which is called its context.
- The context defines which signal and call triggers are defined for this state machine, and which attributes and operations are available in activities of the state machine.
- Signal triggers and call triggers for the state machine are defined according to the receptions and operations of this classifier.


- The State Machine diagram represents a single object.
- The diagram shows how external force causes a change in the object over its lifetime.
- The next figure shows a partial State Machine diagram that models how a seat at a show (a "ShowSeat") in the theater system changes each time someone attempts to make a change to it.
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b7d1a00d-9cbc-4ad1-b880-53c61c917272/Untitled
- Each attempt (an event) can change the seat's condition (called a state).
- The select event caused the seat to change from a state in which it is "Not Priced, Not Selected, and Not Sold" to a state in which it is "Not Priced, Selected, Not Sold".
- The select event is not recognized in this new state so it has no effect.
- The diagram illustrates this by showing that there is no arrow with the select event leaving this state.
- The
price()
event is recognized with an outgoing arrow labeled price()
and causes the object to change to yet a third state.
