Command Pattern

Posted: March 29, 2014 in Behavioral Patterns, Design Patterns
Tags: , ,

As per the definition given by gang of four command pattern facilitates encapsulating a command request as an object – which means representing an action as an object

  1. This pattern helps us to persists a request/action in the form of an object
  2. The command pattern is a behavioral design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time
  3. It will allow you to have each of these actions as a separate object which you can save, retrieve and perform operations on the respective objects
  4. It’s basically designing our commands as objects

This pattern can be used everything from websites implementing complicated features like undo to implementing simple features like parsing command line arguments in console application.
I have used Job Life Cycle commands as an example to demonstrate command pattern. I hope that you would find it interesting and use it in your own applications.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s