CSC/ECE 517 Fall 2010/ch4 4f sv: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Command Pattern in static and dynamic languages ==
== '''Command Pattern in static and dynamic languages''' ==
 
== What is Command Pattern ? ==
          The command pattern is a design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time. This information includes the method name, the object that owns the method and values for the method parameters. It encapsulates a request as an object and gives it a known public interface. It ensures that every object receives its own commands and provides a decoupling between sender and receiver. In this case a sender is an object that invokes an operation, and a receiver is an object that receives the request and acts on it.

Revision as of 22:15, 15 October 2010

Command Pattern in static and dynamic languages

What is Command Pattern ?

          The command pattern is a design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time. This information includes the method name, the object that owns the method and values for the method parameters. It encapsulates a request as an object and gives it a known public interface. It ensures that every object receives its own commands and provides a decoupling between sender and receiver. In this case a sender is an object that invokes an operation, and a receiver is an object that receives the request and acts on it.