Solly
Lesson

Vocabulary: State

Vocabulary after construction: State

The previous exercise began with Expected Behavior and design pressure, not with this name.

The structure that emerged is traditionally called State.

What the reasoning established

  • Stable role: A state promises transition(event) and a name.
  • Change pressure: Behavior varies with current mode.
  • Ownership/lifetime when relevant: State objects are created by transitions or the composition boundary; the context owns only the current one.
  • Structural consequence: The context stores the current state object.
  • Runtime topology: handle delegates the event to state, then installs the returned state.

Nearby distinction

Strategy: State models behavior tied to changing owned mode; Strategy is an independently selectable algorithm/policy.

Simplify

Ask whether any abstraction can be removed while preserving the original acceptance behavior and design-stress property. If yes, prefer the simpler design.

Use the pattern name to communicate a structure you can already justify. Do not use the name as a recipe that replaces requirements analysis.

Sign in with an enabled provider to save your lesson progress.
Sign in to track progress

Loading sign-in options…