<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Pixel Code &#187; command</title>
	<atom:link href="http://www.thepixelcode.com/tag/command/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thepixelcode.com</link>
	<description>Design / Develop / Inspiration by Mohammed Khan</description>
	<lastBuildDate>Mon, 19 Jul 2010 03:45:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Working with Command Pattern &#8211; Interface</title>
		<link>http://www.thepixelcode.com/development/flash/working-with-command-pattern</link>
		<comments>http://www.thepixelcode.com/development/flash/working-with-command-pattern#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:46:47 +0000</pubDate>
		<dc:creator>Mohammed Khan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://www.thepixelcode.com/?p=294</guid>
		<description><![CDATA[Applications that require undo/redo functionality, can be constructed using the Command Pattern. Other uses of command pattern can be to construct reusable components, process queued requests, and develop wizard or transactional applications. As the name goes, Command pattern encapsulates functionality into a class and consist of five elements: 1. Interface 2. Concrete Command 3. Receiver [...]]]></description>
			<content:encoded><![CDATA[<p>Applications that require undo/redo functionality, can be constructed using the Command Pattern. Other uses of command pattern can be to construct reusable components, process queued requests, and develop wizard or transactional applications. As the name goes, Command pattern encapsulates functionality into a class and consist of five elements:</p>
<p>1. Interface<br />
2. Concrete Command<br />
3. Receiver<br />
4. Client<br />
5. Invoker</p>
<div id="attachment_332" class="wp-caption alignnone" style="width: 460px"><a href="http://www.thepixelcode.com/wp-content/uploads/2009/08/Command-Pattern-Structure2.jpg"><img src="http://www.thepixelcode.com/wp-content/uploads/2009/08/Command-Pattern-Structure2.jpg" alt="Command Pattern Structure" title="Command Pattern Structure" width="450" height="235" class="size-full wp-image-332" /></a><p class="wp-caption-text">Command Pattern Structure</p></div>
<p>In this post I will touch upon <strong>Interface</strong> element of the command pattern. The command interface defines the <em>execute()</em> method, which is responsible for executing the requested operation. Also multiple command types can be implemented using the same interface. The command interface provides a programmatic approach to manage the objects which have disparate modes of operation.</p>
<pre class="java">
//General interface implementation
package com.thepixelcode.sampleCPExample.commands {

  public interface ICommand {
     function execute():void;
  }

}
</pre>
<p>The above snippet can be further extended to support the redo/undo functionality, and in order to implement, we would need to create two command interfaces, one for redo and another for undo which shall extend the <strong>ICommand</strong>.</p>
<pre class="java">
//Interface for undo
package com.thepixelcode.sampleCPExample.commands {

  public interface IUndoCommand extends ICommand {
     function undo():void;
  }
}

//Interface for redo
package com.thepixelcode.sampleCPExample.commands {

  public interface IRedoCommand extends ICommand {
     function redo():void;
  }
}
</pre>
<p>I didn&#8217;t want to write a long post over the weekend, also neither i wanted to loose on my writing spirit. Shall continue on other elements and a demo app in next post. Till then have a great weekend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thepixelcode.com/development/flash/working-with-command-pattern/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
