I learned about the Command Design pattern and saw different implementations of it:
1:
Receiver receiver = new Receiver();
Command command = new ConcreteCommand(receiver);
Invoker invoker = new Invoker();
invoker.SetCommand(command);
invoker.ExecuteCommand();
2:
Remote remote = new Remote();
DVDPlayCommand dvdPlayCommand = new DVDPlayCommand();
remote.Invoke(dvdPlayCommand);
Probably, I missed something, but the second implementation seems less complicated and more clear from my point of view.
First implementation calling chain: ExecuteCommand(
) calls to Execute()
calls to Action()
Second implementation calling chain: Invoke()
calls to Execute()
Does the first implementation have advantages over the second?