Context: |
Initiator of action cannot (or need not) be there in time to launch the action (e.g. scheduling, selection from menu). Possibly, action may be undone later. |
||||||||||
Challenge: |
To encapsulate the execution request with its arguments (and possibly its undo arguments). |
||||||||||
Skill: |
|||||||||||
Participants: |
|
||||||||||
Signature: |
Invoker contains Commands. Concrete Command references Receiver. Client references (or contains) both Receiver and Invoker, creates the Command and registers it with Invoker. |
||||||||||
Used by: |
Order of initialization pattern, Observer pattern, menu systems, transaction-based systems. |
||||||||||
Scope: |
Languages that do not support bound methods / delegates. General (when involving more data or functionality than just the receiver, method and invoke-time arguments). |