🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

State Pattern

In plain terms

A pattern letting an object change behavior as its state changes.

Going deeper

The State pattern represents each state as an object, so an object's behavior shifts by switching its current state, replacing big conditionals. Behavior follows state.

Under the hood

Encapsulates state-specific logic; cleaner than sprawling if/switch on a status field.

Examples

State machines, workflow status, UI modes, game character states, parsers.

Think of it like...

Like a traffic light behaving differently in each color state, swapping rules as it changes.

Feedback & Bug Report