UML State Machine Diagram Example
This is an example of UML behavioral state machine diagram showing Bank Automated Teller Machine (ATM) top level state machine.
ATM is initially turned off. After the power is turned on, ATM performs startup action and enters Self Test state. If the test fails, ATM goes into Out of Service state, otherwise there is triggerless transition to the Idle state. In this state ATM waits for customer interaction.
The ATM state changes from Idle to Serving Customer when the customer inserts banking or credit card in the ATM's card reader. On entering the Serving Customer state, the entry action readCard is performed. Note, that transition from Serving Customer state back to the Idle state could be triggered by cancel event as the customer could cancel transaction at any time.
Behavioral state machine UML diagram example - Bank ATM
Serving Customer state is a composite state with sequential substates Customer Authentication, Selecting Transaction and Transaction. Customer Authentication and Transaction are composite states by themselves which is shown with hidden decomposition indicator icon. Serving Customer state has triggerless transition back to the Idle state after transaction is finished. The state also has exit action ejectCard which releases customer's card on leaving the state, no matter what caused the transition out of the state.