State Machine Diagram Example: Ticket Selling System

Description:

This example shows a state diagram for the history of a ticket. The initial state of a ticket is the Available state. Before the season starts, seats for season subscribers are assigned. Individual tickets purchased interactively are first locked while the customer makes a selection. After that, they are either sold or unlocked if they are not chosen. If the customer takes too long to make a selection, the transaction times out and the seat is released. Seats sold to season subscribers may be exchanged for other performances, in which case they become available again.

What is State Machine Diagram?

A state machine diagram consists of a finite number of states that embody information about the current situation in the system. The state machine is always in one of the finite states. Events are outside stimuli to the state machine. Triggered by events, each state has transitions to other states. A transition does not have to move the state machine to another state; it can also loop back to the same state. During a transition, some actions (called transition actions) might be performed. Many forms of state diagrams exist, which differ slightly and have different semantics. In UML semantics, an activity diagrams are reducible to State Machines with some additional notations

Why state machines?

  • State machines are formally defined, they form executable models.
  • State machines can be visualized as diagrams and animated through simulators without writing any code.
  • You can simulate, test, debug state diagram as a virtual machine for a problem, for example, was the door locked with a card or a code?

Keen to try VP Online?

No limitations, no obligations, no cancellation fees.


Start a Free Trial