State in a Stateless World
summary
Argues that ad‑hoc status fields fail when business rules grow and instead implements a state pattern (door example where base methods throw exceptions and concrete states override allowed transitions) and full state machines using Symfony Workflow or winzou equivalents. Shows YAML config with a marking_store persisted property, explains lifecycle events (including guard events, enter/leave/entered/completed) for checks and side effects, recommends testing and logging, and warns that removing persisted states from code breaks existing DB rows.
AI-written summary · about
chapters (12)
- 0:00Introduction and welcome
- 1:26Why state is necessary
- 7:37State pattern explained
- 15:22State machines vs state pattern
- 17:34Symphony workflow setup
- 20:10Using workflow in practice
- 24:04Workflow features and benefits
- 27:20When to use state machines
- 31:05Implementation tips
- 34:16Logging and event sourcing
- 36:46Recap and key takeaways
- 39:18Q&A session
