Build an Order State Machine
State pattern
Challenge 4 of Decouple EventsIntermediate~55 minFree
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.