Wednesday, January 1, 2014

Command Pattern

In command pattern an object is used to represent and encapsulate (hide information) all the information needed to call a method at a later time. 



We are not directly interact with the event receiver. Instead we use Command Objects to interact



Receiver : Has operations to be executed
Invoker : Calls command to carryout operations. Command object is passed to an invoker object which invokes the command. 
Command : Declares an interface for executing operations. It has Receiver object.
ConcreteCommand : Invoke operations defined on Receiver (links Receiver and action)
Client : Creates ConcreteCommand and sets its Receiver. Holds both invoker objects and command objects. It passes command objects to the invoker  

Example for C#

Usage
  • GUI buttons
  • Macro recording
  • Multi level undo
  • Progressbars
  • Wizards
wikipedia
http://stackoverflow.com/questions/tagged/command-pattern

0 comments:

Post a Comment

Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook