State machines are great, but hard to establish
The author reflects on the challenges of adopting state machines in frontend development — from team buy-in to the pitfalls of mixing state-driven logic with traditional code — and invites readers to share their own experiences.
As much as I love working with state machines in the frontend side of the UI, the most hard thing to do with it is to convince your team that they are great and they solve most of the problems in terms of logic, feature iteration and confidence in the code you push to production.
One of the worst scenarios I am right now is when some app logic is inside the state machine and some is outside. Is really hard to follow what is actually happening when there's this mix of state logic in the same app/feature.
what about you? Do you love/hate state machines? what is your current opinion of them?
Related:
- State machines to visualize the work of agents — using state machines to make LLM agent behavior more deterministic and observable
- Modeling resizable panels using State Machines — a concrete example of state-machine-driven UI for resizable panel layouts
- Notes about how the document machine should work — applying explicit state transitions to the Seed document editing lifecycle
- UI with State Machines — external hub with practice guides, patterns, and case studies on state-driven UI
- Why aren't we using state machines more in our complex application? — same problem from a product-team angle: state machines are proven but still underused across complex app scenarios
- Agents and State Machines — formal state machine model for Pi-sdk-based agents (Lamport + Kay style), extending the state machine concept beyond UI to agent orchestration
- Our distributed objects are state machines — Lamport's foundational interview reveals that the state machine idea in his most cited paper was "almost completely ignored," mirroring this post's adoption challenge
- State Machines — Knowledge Map — hub page collecting all state-machine-related documents across the repository
- Split Logic Detector (Opportunity #24) — ESLint plugin detecting when logic leaks outside the state machine, addressing the #1 blocker named in this post
- State Machine Adoption Kit (Opportunity #25) — convince-your-team playbook: audience briefs, before/after metrics, counter-arguments, migration plan