Intent
Encapsulate a request as an object, thereby letting you parameterize objects
with different requests.
Applicability
- parameterize objects by action to be performed
- queue or log requests
- support undo
Structure
[to do: diagram with Invoker, Command, Receiver]
Consequences
- decouples invoker from receiver
- commands are first class objects that can be passed around etc.
- it is easy to add new commands
- invoker only knows a simple interface
Implementation
- command can have a wide range of abilities
- support undo/redo
Uses in JHotDraw