intermediateDesign Patterns~55 min
Order State Machine (State Pattern)
Model an order's lifecycle the way real systems do — as a state machine. Drive transitions from a table, expose what each state allows, record history, run entry actions on arrival (charge, email), and gate transitions with guards. The State pattern behind checkout flows and TCP.