<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Is There An Idiomatic Command Pattern Implementation For JavaScript?</title>
	<atom:link href="http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/</link>
	<description>Better Than Yesterday</description>
	<lastBuildDate>Mon, 20 May 2013 17:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: coulix</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-3010</link>
		<dc:creator>coulix</dc:creator>
		<pubDate>Tue, 29 Jan 2013 12:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-3010</guid>
		<description>Hi Derick, how would you do an undo/redo command pattern using marionnette command https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.commands.md ?</description>
		<content:encoded><![CDATA[<p>Hi Derick, how would you do an undo/redo command pattern using marionnette command <a href="https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.commands.md" rel="nofollow">https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.commands.md</a> ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Cadwallader</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-2231</link>
		<dc:creator>Dave Cadwallader</dc:creator>
		<pubDate>Sat, 18 Feb 2012 01:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-2231</guid>
		<description>Just saw that your implementation of Marionette.AppRouter handles this decoupling nicely using the &quot;controller&quot; object.

However, this only works for Routes (URLs) and not for plain old application events.

I&#039;d wonder if we could take this concept one step further, and allow an Application instance to bind &quot;events&quot; to &quot;controller methods&quot;.  This would allow non-view &quot;commands&quot; to respond to application events dispatched onto the Event Aggregator (&quot;vent&quot;).

For instance, I might have a page that has a form and a &quot;Save&quot; button.  When the button is clicked, I want to dispatch a &quot;Save&quot; event that gets picked up elsewhere by some non-view code.

On another note, do you support nested Marionette Applications?  For instance, in a multi-tabbed layout, where the outer container is the &quot;parent app&quot; and each tab is a &quot;child app&quot;.  The children want to have their own &quot;vent&quot; to handle events that only concern the tab, but they also want the ability to communicate with the parent shell for system-wide events such as opening a new tab, etc.

Thanks for the great articles and framework!</description>
		<content:encoded><![CDATA[<p>Just saw that your implementation of Marionette.AppRouter handles this decoupling nicely using the &#8220;controller&#8221; object.</p>
<p>However, this only works for Routes (URLs) and not for plain old application events.</p>
<p>I&#8217;d wonder if we could take this concept one step further, and allow an Application instance to bind &#8220;events&#8221; to &#8220;controller methods&#8221;.  This would allow non-view &#8220;commands&#8221; to respond to application events dispatched onto the Event Aggregator (&#8220;vent&#8221;).</p>
<p>For instance, I might have a page that has a form and a &#8220;Save&#8221; button.  When the button is clicked, I want to dispatch a &#8220;Save&#8221; event that gets picked up elsewhere by some non-view code.</p>
<p>On another note, do you support nested Marionette Applications?  For instance, in a multi-tabbed layout, where the outer container is the &#8220;parent app&#8221; and each tab is a &#8220;child app&#8221;.  The children want to have their own &#8220;vent&#8221; to handle events that only concern the tab, but they also want the ability to communicate with the parent shell for system-wide events such as opening a new tab, etc.</p>
<p>Thanks for the great articles and framework!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Cadwallader</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-2230</link>
		<dc:creator>Dave Cadwallader</dc:creator>
		<pubDate>Fri, 17 Feb 2012 22:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-2230</guid>
		<description>Hey Derick, 
I&#039;m really curious to hear what you&#039;ve found out since you wrote this.  I&#039;m currently migrating a Flex-based UI to a JS architecture.  

The Flex UI used a framework called Robotlegs which relied heavily on the Command Pattern, which provided a nice separation between a Context object (whose sole job is to map events to command classes) and the Command objects themselves which were just small single-purpose classes with an &quot;execute()&quot; method.  

This made unit testing a breeze, with a nice clean decoupled architecture.  I&#039;m seeing part of the picture with the Backbone.Events code (and your Event Aggregator post, which is sort of like a Robotlegs Context) but I&#039;d like to take it one step further and have separate Commands instead of callback functions that live within my view code.  

If you haven&#039;t found anything yet, I&#039;d be very interested in collaborating to build what we need!

Thanks,
Dave</description>
		<content:encoded><![CDATA[<p>Hey Derick, <br />
I&#8217;m really curious to hear what you&#8217;ve found out since you wrote this.  I&#8217;m currently migrating a Flex-based UI to a JS architecture.  </p>
<p>The Flex UI used a framework called Robotlegs which relied heavily on the Command Pattern, which provided a nice separation between a Context object (whose sole job is to map events to command classes) and the Command objects themselves which were just small single-purpose classes with an &#8220;execute()&#8221; method.  </p>
<p>This made unit testing a breeze, with a nice clean decoupled architecture.  I&#8217;m seeing part of the picture with the Backbone.Events code (and your Event Aggregator post, which is sort of like a Robotlegs Context) but I&#8217;d like to take it one step further and have separate Commands instead of callback functions that live within my view code.  </p>
<p>If you haven&#8217;t found anything yet, I&#8217;d be very interested in collaborating to build what we need!</p>
<p>Thanks,<br />
Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1970</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Mon, 21 Nov 2011 12:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1970</guid>
		<description>well, fortunately I know how to read JavaScript :D

that implementation is the same as what I showed here. maybe i should just flesh mine out a bit and be done with it.</description>
		<content:encoded><![CDATA[<p>well, fortunately I know how to read JavaScript :D</p>
<p>that implementation is the same as what I showed here. maybe i should just flesh mine out a bit and be done with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1969</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 21 Nov 2011 04:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1969</guid>
		<description>I just ran across a Node.js app that is using the command pattern (and also a dependency injector, which is also interesting).

And it&#039;s you&#039;re luck day, because they wrote it in CoffeeScript!!!

https://github.com/idflood/ThreeNodes.js

Enjoy</description>
		<content:encoded><![CDATA[<p>I just ran across a Node.js app that is using the command pattern (and also a dependency injector, which is also interesting).</p>
<p>And it&#8217;s you&#8217;re luck day, because they wrote it in CoffeeScript!!!</p>
<p><a href="https://github.com/idflood/ThreeNodes.js" rel="nofollow">https://github.com/idflood/ThreeNodes.js</a></p>
<p>Enjoy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1959</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Sat, 19 Nov 2011 04:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1959</guid>
		<description>there&#039;s far more to messaging then just pub/sub. point-to-point (commands) and request/response are very valuable patterns that also have their place. there&#039;s a semantic difference that is significant, and there&#039;s often an implementation difference - though my simple example here obviously hasn&#039;t shown one - hence my asking for a good, idiomatic implementation instead of just using what i provided as an example.

just because we technically can do everything as events doesn&#039;t mean we should. this leads to terrible code. believe me - or my former coworkers. you can ask many of them about the horrible things i did to our systems by ignoring request/response and saying events or events + commands were good enough. :-/

semantics are important as they often lead to technical and implementation differences.</description>
		<content:encoded><![CDATA[<p>there&#8217;s far more to messaging then just pub/sub. point-to-point (commands) and request/response are very valuable patterns that also have their place. there&#8217;s a semantic difference that is significant, and there&#8217;s often an implementation difference &#8211; though my simple example here obviously hasn&#8217;t shown one &#8211; hence my asking for a good, idiomatic implementation instead of just using what i provided as an example.</p>
<p>just because we technically can do everything as events doesn&#8217;t mean we should. this leads to terrible code. believe me &#8211; or my former coworkers. you can ask many of them about the horrible things i did to our systems by ignoring request/response and saying events or events + commands were good enough. :-/</p>
<p>semantics are important as they often lead to technical and implementation differences.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Domenic Denicola</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1958</link>
		<dc:creator>Domenic Denicola</dc:creator>
		<pubDate>Sat, 19 Nov 2011 03:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1958</guid>
		<description>If you&#039;re not doing undo-style examples, and you are in fact doing a messaging-type system, then this is definitely just event handling. In JavaScript circles this is often known as &quot;pubsub.&quot;

So, basically, the idiomatic way of doing commands in JavaScript is to rephrase your problem in terms of events.</description>
		<content:encoded><![CDATA[<p>If you&#8217;re not doing undo-style examples, and you are in fact doing a messaging-type system, then this is definitely just event handling. In JavaScript circles this is often known as &#8220;pubsub.&#8221;</p>
<p>So, basically, the idiomatic way of doing commands in JavaScript is to rephrase your problem in terms of events.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1957</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Fri, 18 Nov 2011 23:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1957</guid>
		<description>other than the semantics, it is the same - hence my mentioning that in the post :)

but semantics are important, and a simple example like this isn&#039;t going to have any differentiating features. a more feature complete example might... maybe... i dunno yet. i haven&#039;t found one that I like, yet.</description>
		<content:encoded><![CDATA[<p>other than the semantics, it is the same &#8211; hence my mentioning that in the post :)</p>
<p>but semantics are important, and a simple example like this isn&#8217;t going to have any differentiating features. a more feature complete example might&#8230; maybe&#8230; i dunno yet. i haven&#8217;t found one that I like, yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Tybor</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1956</link>
		<dc:creator>Adam Tybor</dc:creator>
		<pubDate>Fri, 18 Nov 2011 22:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1956</guid>
		<description>This just looks like standard event handling.  Subscribe to a command with a callback, trigger the callback.  Outside of linguistic semantics around a command vs event, what is the difference with your implementation?</description>
		<content:encoded><![CDATA[<p>This just looks like standard event handling.  Subscribe to a command with a callback, trigger the callback.  Outside of linguistic semantics around a command vs event, what is the difference with your implementation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Kornov</title>
		<link>http://lostechies.com/derickbailey/2011/11/18/is-there-an-idiomatic-command-pattern-implementation-for-javascript/#comment-1955</link>
		<dc:creator>Victor Kornov</dc:creator>
		<pubDate>Fri, 18 Nov 2011 22:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=677#comment-1955</guid>
		<description>this days I simply go for jQuery&#039;s custom events (pseudo-code):
var controller = {
    handler: function(data) {
          console.log(data);
    }
}
var model = {
     event_happens: function() {
            $(this).triggerHanler(&#039;event_command&#039;, { data: &#039;goes here&#039; });
     }
};
$(model).bind(&#039;event_command&#039;, controller.handler);
model .event_happens();</description>
		<content:encoded><![CDATA[<p>this days I simply go for jQuery&#8217;s custom events (pseudo-code):<br />
var controller = {<br />
    handler: function(data) {<br />
          console.log(data);<br />
    }<br />
}<br />
var model = {<br />
     event_happens: function() {<br />
            $(this).triggerHanler(&#8216;event_command&#8217;, { data: &#8216;goes here&#8217; });<br />
     }<br />
};<br />
$(model).bind(&#8216;event_command&#8217;, controller.handler);<br />
model .event_happens();</p>
]]></content:encoded>
	</item>
</channel>
</rss>
