State Diagram — UML diagram showing states and transitions of an object.
When to use:
Components:
States: rounded rectangles
Initial State: filled circle (●)
Final State: bullseye (◎)
Transitions: arrows with trigger [guard] / action
Guard Conditions: [condition]
Actions: / action
Order Example:
● → Created → [Payment received] / Paid → Processing
Processing → [Shipped] / SentNotification → Shipped
Shipped → [Delivered] → Delivered → ●
Created → [Cancelled] → Cancelled → ●
Benefits: Visualizes lifecycle, catches missing transitions.