- The Command pattern creates distance between the client that requests an operation and the object that can perform it.
Class diagram: (see Command Pattern code review)
Use the Command Pattern when you want to:
- Specify, queue, and execute commands at different times.
- Support an Undo function for commands.
- Support auditing and logging of all changes via commands.