$> git checkout command
Intent
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. 1
Applications
When you need to decouple an object that performs an action from an object that invokes an action, this is a good pattern to use. What does that last part really mean, though? Suppose you want to queue up a list of events that all do various different things. Later you will purge the queue, which will actually invoke all of those actions. Why would you not just invoke/perform the action immediately? There ...