The purpose of the pattern is to decouple the Receiver from the Invoker.
Receiveris the object that "knows" how to perform the action. It hold the business logic. of the application.Invokeris the actual executor of the command. I doesn't know nothing about theReceiver.- The
Commandtakes theReceiverobject:Command cmd = new SomeCommand(Receiver r). - The
Clienthas responsibilities to instantiate theCommandobject and to inject it to theInvoker.