Lesson
Vocabulary: Command
Vocabulary after construction: Command
The previous exercise began with Expected Behavior and design pressure, not with this name.
The structure that emerged is traditionally called Command.
What the reasoning established
- Stable role: A command exposes execute(); the receiver exposes place(request).
- Change pressure: Different requests/actions can become first-class objects.
- Ownership/lifetime when relevant: Input ownership is established when the command is created.
- Structural consequence: The command owns its request snapshot and a receiver reference.
- Runtime topology: Invokers execute the command without knowing receiver details.
Nearby distinction
Strategy: Command owns an invocation plus the data/lifetime needed to execute it later; Strategy represents a replaceable algorithm.
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…