Is Invoker class optional in Command design pattern? Client needs to instantiate Concrete Command and Receiver for the command. Does client always need to instantiate Invoker and pass on the command object to Invoker object. Later on whenever client needs to execute the command, client just asks Invoker object and Invoker performs the command (maybe immediately or may queue the command for later execution).
Or is this other way around? If client needs to perform the command synchronously, client will reference the command using base class interface but will instantiate concrete command and receiver. Whenever client will need to perform the command, client will just call the execute method on base class command variable? When there will be a need of some additional logic of when a command should get executed, Invoker class will be used to keep that additional logic and client will interact with Invoker object to perform the command?