Finite state modeling

Slap yourself if

You think finite state modeling is just enums with extra ceremony.

Why this exists

Finite state modeling exists because ad-hoc boolean flags and loosely coupled state variables eventually describe impossible states. FSMs force you to model reality instead of hoping your conditionals line up.

Mental model

An FSM is a contract about what can happen next. State is not a bag of values — it’s a position in a graph, and transitions are the only legal moves.

  • The system is described as a finite set of mutually exclusive states.
  • Transitions define which states can move to which, and why.
  • Events are interpreted relative to the current state.
  • Invalid transitions are rejected by construction, not by convention.
  • Modeling data shape instead of behavior.
  • Letting multiple flags imply state instead of encoding it explicitly.
  • Adding escape hatches that bypass transitions.
  • Treating FSMs as UI-only abstractions.

Finite state modeling represents application behavior as explicit states and transitions, preventing impossible combinations by encoding what can happen next instead of inferring it from flags.

  • Multiple booleans describing the same lifecycle
  • State transitions hidden in side effects
  • Impossible UI states explained as ‘edge cases’
  • FSMs dismissed as overengineering

Deep dive

Requires Pro

Premium deep dives include more internals, more scars.

What FSMs actually buy you at runtime

How non-modeled state rots over time

Where FSMs hurt

Debugging with states instead of flags

When FSMs are the wrong abstraction