ProcessSample

State machine diagram

The life of one object: the states it can be in, the events that move it between them, and the conditions that must hold. Anything not drawn is not allowed.

Try this

  1. 01Fire events from Draft to Delivered. Only the buttons valid in the current state are enabled.
  2. 02Try to ship an order that is still Placed: impossible, because no arrow allows it. This is how status columns stay clean.
  3. 03Cancel after paying, then reset and return a delivered order: two different routes to an end.

Notation

State (rounded box)
A condition the object is in for a while (Paid, Shipped).
Initial state (filled dot)
Where every object starts.
Final state (ringed dot)
Where its life ends.
Transition (arrow)
A move from one state to another, triggered by an event.
Event
Something that happens (pay, ship). Written on the arrow.
Guard [in brackets]
A condition that must be true for the transition to fire.

Use it when

  • Status columns and workflow engines (orders, tickets, claims)
  • Validating which updates an API should accept
  • Defining data quality rules for status transitions

Avoid it when

  • Several objects or roles interact (use BPMN or a sequence diagram)
  • The object has only two or three trivial states

More in Process