State
Lets an object change its behavior when its internal state changes, by delegating behavior to a state object rather than branching on a status field everywhere.
Why we need this / what value this brings
Replaces scattered if status == X branching with one object per state, each knowing only its own valid transitions and behavior.
When to use this
An object's behavior depends heavily on a status/state field, and that field has more than a couple of states with different valid transitions.
How to use or implement this
Define one class per state implementing a shared interface, have the context object delegate to its current state, and let each state object decide (and perform) the transition to the next.
Research questions
- Booking status (pending → confirmed → completed/cancelled) is the textbook case here — worth checking whether
services/bookingscentralizes valid transitions in one place or checksstatus == "..."at each call site.
Empty folder — drop notes, links, and findings here as you research.