Skip to content
State machine (FSM) templates

Teaching Case — Two Boxes With One Name

`Cancelled` and `Void` are different states with the same label, so the figure prints one name twice. A reader cannot tell which arrow goes where, and a transition between the pair is indistinguishable from a self-transition on either of them — a defect that lives entirely in the drawing and cannot be seen by reading the source, which is where every reviewer looks.

Template previewState machine (FSM)
Booking lifecycle5 states · 4 transitions · 4 eventspayexpirechargebackcheck_outHeldConfirmedCancelledCancelledCompleted1 thing is probably not what was meant; every transition names states that exist.WARN`Cancelled` and `Void` are different states and their boxes both read "Cancelled". The figure shows one name twice, so a reader cannottell which arrow goes where — and a self-transition and a transition between the pair are then indistinguishable.OKAll 5 states are reachable from `Held`.OKEvery run from `Held` can reach a final state.OKAll 4 transitions name states that exist, so every arrow in the figure is drawn.

Make it your own.

title "Booking lifecycle"

state Held
state Confirmed
state Cancelled label "Cancelled" final
state Void      label "Cancelled" final
state Completed final

initial Held

transition Held      -> Confirmed on "pay"
transition Held      -> Cancelled on "expire"
transition Confirmed -> Void      on "chargeback"
transition Confirmed -> Completed on "check_out"