State machine
Also called: Finite state machine, FSM, State pattern
A model where something is always in exactly one of a fixed set of states, and events move it from one state to another by explicit rules.
Definition
Instead of several booleans that can combine into impossible situations, a state machine has one current state and a transition function (state, event) to next state. Every rule lives in one place, unexpected events in a state become a deliberate decision, and transitions can be tested as a table. The State pattern implements it with one object per state.
In practice
A media player is idle, loading, playing, paused or failed; tapping Play while loading does nothing, by rule.