- Summary
- Encapsulate a request in an object and allows the parameterization of clients with different requests and optionally saves the requests in a queue.
- Overview Tutorials
- http://www.oodesign.com/command-pattern.html
- Types
- Simple Command Pattern
- Client Encapsulate the command object and invoke
ICommand.Execute() funtions and command return final outcome to client.
- Invoker based command Pattern
- Client creates a concrete command and pushes it
to invoker.
- Invoker call execute function of command that
activate Receiver (Target Object on which command need to work on)
- Once done command return a final outcome to
client via invoker.
- Distributed (Queued) Command Pattern
- Specific Considerations
- Invoker and Chain of responsibility
- Both work with a request object however command pattern works only at
receiver end and can be used in conjuction.
- Advantage
- The
main advantage of the command design pattern is that it decouples the object
that invokes the operation from the one that know how to perform it.
- The
invoker should be aware only about the abstract command class.
- Client
can also work as invoker in simple scenario.
|
|