The pattern encapsulates the request as an object of its own. Usually, when one object makes a request for a second object to do an action, the first object will call a method of the second object and the second object would complete the task.
Common way:

Visualization of the Command design pattern:

In this way, the Sender doesn’t need to know about the receiver and the methods to call.
The Command pattern has another object that invokes the command object to complete whatever task it is supposed to do, called the invoker.
Continue reading “Command Pattern”






