← Graph

Use state machines instead of boolean flags

takeaway 1 connections

Boolean flags encode state implicitly and explode combinatorially (N flags → 2^N states). If system behavior depends on its state, define an explicit state machine — system behavior becomes defined for every state and transitions are gated. Almost everything in software engineering can be described as a state machine; a single model can even have multiple state machines when needed. Implicit flags often hide as dates, periods, presence of associations, or status fields.

type
recommendation
takeaway Use state machines instead of boolean flags
from_talk
Key recommendation from the flags-and-state section.

Provenance

Read by
2 extractions