<?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: commanding dawn</title>
	<atom:link href="http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/</link>
	<description>I wish I got it right more!</description>
	<lastBuildDate>Tue, 18 May 2010 00:58:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1-alpha-15359</generator>
	<item>
		<title>By: Glidias</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-59</link>
		<dc:creator>Glidias</dc:creator>
		<pubDate>Sat, 27 Mar 2010 04:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-59</guid>
		<description>One thing about the above approach though, you&#039;d have to create a whole list of specific Notification classes to handle each matching command in 1-to-1 mapping (even though they might have the same type of properties and extend from a base class), rather than being able to map 1 notification/event class with multiple string identifiers to be used for each command (1-to-*) in typical RobotLegs fashion.  Sometimes, event strings serve as a necessity to conveniently reuse the same event for multiple commands.

In the 1-to-1 mapping approach, the only way I see how one can lower the number of Notification classes being used (instead of extending meaninglessly to support different Notification class name signatures) is letting the command process some given &quot;type&quot; variable of that notification (via switch-case), and handle multiple command cases tied to a single notification class within the command itself. This could very well mean lesser Command/Event classes being used, but a longer command class code because it handles multiple type cases, moving closer to a 1-shot controller somewhat.  It can be a bit harder to manage when dealing with undoable commands which might contain undoable information more specific to a particular action gesture, or more testable commands which should be written as a sole class handling 1 specific case only.

Another way (for a Robotlegs app i&#039;m doing which handles many commands/gestures) is to simply let each given public static const string in an Event class be marked with some [CommandGesture] meta-data, whose resolved string value must match the given command name (via some logical type-matching convention). When mapping a Command class, the assosiated event/notification class is being inspected for a matching CommandGesture string in the event, and if no matching trigger is found based on the string-matching convention, it throws an error. This does force the developer to create proper events strings that would be resolved to auto-mapped command class names, but at least, the app throws out warnings/errors if the mapping fails. As far as configuration goes, the only thing required is to simply list out all the commands to be auto-wired, since the rest is handled by convention.</description>
		<content:encoded><![CDATA[<p>One thing about the above approach though, you&#8217;d have to create a whole list of specific Notification classes to handle each matching command in 1-to-1 mapping (even though they might have the same type of properties and extend from a base class), rather than being able to map 1 notification/event class with multiple string identifiers to be used for each command (1-to-*) in typical RobotLegs fashion.  Sometimes, event strings serve as a necessity to conveniently reuse the same event for multiple commands.</p>
<p>In the 1-to-1 mapping approach, the only way I see how one can lower the number of Notification classes being used (instead of extending meaninglessly to support different Notification class name signatures) is letting the command process some given &#8220;type&#8221; variable of that notification (via switch-case), and handle multiple command cases tied to a single notification class within the command itself. This could very well mean lesser Command/Event classes being used, but a longer command class code because it handles multiple type cases, moving closer to a 1-shot controller somewhat.  It can be a bit harder to manage when dealing with undoable commands which might contain undoable information more specific to a particular action gesture, or more testable commands which should be written as a sole class handling 1 specific case only.</p>
<p>Another way (for a Robotlegs app i&#8217;m doing which handles many commands/gestures) is to simply let each given public static const string in an Event class be marked with some [CommandGesture] meta-data, whose resolved string value must match the given command name (via some logical type-matching convention). When mapping a Command class, the assosiated event/notification class is being inspected for a matching CommandGesture string in the event, and if no matching trigger is found based on the string-matching convention, it throws an error. This does force the developer to create proper events strings that would be resolved to auto-mapped command class names, but at least, the app throws out warnings/errors if the mapping fails. As far as configuration goes, the only thing required is to simply list out all the commands to be auto-wired, since the rest is handled by convention.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Penner</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-58</link>
		<dc:creator>Robert Penner</dc:creator>
		<pubDate>Wed, 24 Mar 2010 21:38:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-58</guid>
		<description>I&#039;m certainly with you on the event constants. I don&#039;t like mapping with strings, constants or no, because they&#039;re easy to fake. With class and object references, you can&#039;t fake it--you either have the right thing or you don&#039;t.</description>
		<content:encoded><![CDATA[<p>I&#8217;m certainly with you on the event constants. I don&#8217;t like mapping with strings, constants or no, because they&#8217;re easy to fake. With class and object references, you can&#8217;t fake it&#8211;you either have the right thing or you don&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-57</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Wed, 24 Mar 2010 13:26:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-57</guid>
		<description>Hey, thanks a lot for taking a look at this btw, its awesome to have a critical eye look it over!!

I totally agree that the compiler is the best tool for spotting errors! Thats my whole aim in increasing type safety.

The problem I want to avoid (like the plague) is when strongly typed code is in fact not type safe.

The classic example is events, here is some strongly typed code (the compiler loves it :) ) that is far from type safe

myObject.addEventListener(Event.Close, function(event:Event):void{});

// later on

myObject.addEventListener(MyEvent.Close, function(event:MyEvent):void{});

Since both MyEvent.CLOSE and Event.CLOSE are equal to &quot;close&quot; both listeners will be triggered by both events, and the strongly typed code will throw a runtime type error.

So strong typing is very very valuable, but it can also cause unfounded confidence in non-strict code.

With my approach there is a clear limitation!  The developer may misspell Execute, and the compiler will not be there to help them out.  But there is also a clear advantage, there is no possibility of the developer triggering a command with an incorrect type that consequently throws a runtime error.

With the approach of injecting the notification via a property and mapping the command to the notification

&gt; commandMap.addCommand(MakeHay, MakeHayCommand);

We remove the problem of the compiler not informing us that the execute method is misspelled, but I do not believe we create a more type safe situation, we just return to adding a mapping step.

I personally would rather (since there is no silver bullet which achieves type safety and strong typing, that I can yet see) use the approach that keeps the mapping in context, i.e. the mapping is done in the object that takes action on the notification rather than in a removed mapping step.
It also removes some duplication, since creating a command that depends on a notification via an inject does not definitively map that command to that notifications type, so we then have to map it (two places we have to describe what type the command is expecting).  In the approach I am describing the dependency and the mapping are one and the same, so never out of date or in disagreement.

Phew, that got me thinking

cheers
Sammy</description>
		<content:encoded><![CDATA[<p>Hey, thanks a lot for taking a look at this btw, its awesome to have a critical eye look it over!!</p>
<p>I totally agree that the compiler is the best tool for spotting errors! Thats my whole aim in increasing type safety.</p>
<p>The problem I want to avoid (like the plague) is when strongly typed code is in fact not type safe.</p>
<p>The classic example is events, here is some strongly typed code (the compiler loves it <img src='http://www.ziazoo.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) that is far from type safe</p>
<p>myObject.addEventListener(Event.Close, function(event:Event):void{});</p>
<p>// later on</p>
<p>myObject.addEventListener(MyEvent.Close, function(event:MyEvent):void{});</p>
<p>Since both MyEvent.CLOSE and Event.CLOSE are equal to &#8220;close&#8221; both listeners will be triggered by both events, and the strongly typed code will throw a runtime type error.</p>
<p>So strong typing is very very valuable, but it can also cause unfounded confidence in non-strict code.</p>
<p>With my approach there is a clear limitation!  The developer may misspell Execute, and the compiler will not be there to help them out.  But there is also a clear advantage, there is no possibility of the developer triggering a command with an incorrect type that consequently throws a runtime error.</p>
<p>With the approach of injecting the notification via a property and mapping the command to the notification</p>
<p>&gt; commandMap.addCommand(MakeHay, MakeHayCommand);</p>
<p>We remove the problem of the compiler not informing us that the execute method is misspelled, but I do not believe we create a more type safe situation, we just return to adding a mapping step.</p>
<p>I personally would rather (since there is no silver bullet which achieves type safety and strong typing, that I can yet see) use the approach that keeps the mapping in context, i.e. the mapping is done in the object that takes action on the notification rather than in a removed mapping step.<br />
It also removes some duplication, since creating a command that depends on a notification via an inject does not definitively map that command to that notifications type, so we then have to map it (two places we have to describe what type the command is expecting).  In the approach I am describing the dependency and the mapping are one and the same, so never out of date or in disagreement.</p>
<p>Phew, that got me thinking</p>
<p>cheers<br />
Sammy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Penner</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-56</link>
		<dc:creator>Robert Penner</dc:creator>
		<pubDate>Wed, 24 Mar 2010 02:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-56</guid>
		<description>I hear what you&#039;re saying about configuration and developer discipline. I would say one of the best enforcers of discipline is the compiler. The Command Map has to be configured somehow, and I would prefer something that will generate a compiler error if configured incorrectly, e.g.:

commandMap.addCommand(MakeHay, MakeHayCommand);

Your metadata approach requires its own kind of developer discipline (put a MakeHay parameter in the method and mark with [Execute]). But the compiler doesn&#039;t complain if it isn&#039;t done correctly.</description>
		<content:encoded><![CDATA[<p>I hear what you&#8217;re saying about configuration and developer discipline. I would say one of the best enforcers of discipline is the compiler. The Command Map has to be configured somehow, and I would prefer something that will generate a compiler error if configured incorrectly, e.g.:</p>
<p>commandMap.addCommand(MakeHay, MakeHayCommand);</p>
<p>Your metadata approach requires its own kind of developer discipline (put a MakeHay parameter in the method and mark with [Execute]). But the compiler doesn&#8217;t complain if it isn&#8217;t done correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Penner</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-55</link>
		<dc:creator>Robert Penner</dc:creator>
		<pubDate>Wed, 24 Mar 2010 01:59:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-55</guid>
		<description>Thanks for the explanation.

&gt; See how I do not have to tell the command map that the MakeHay notification triggers this command!

Right, do you mean you&#039;ve avoided doing something like this?

commandMap.addCommand(MakeHay, MakeHayCommand);

Basically you&#039;ve moved the MakeHay mapping from one place to another. In order to do that, you defined a new metadata tag, parsed it, and created an inability to use a command interface. Personally, I am reluctant to create new metadata when there&#039;s a simple ActionScript equivalent, which is strongly typed and easier to debug.

&gt; My other main reason, was that it is felt familiar to most other command patterns I’ve worked with in the past

When I Google around and look at Wikipedia, I see predominantly execute().</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation.</p>
<p>&gt; See how I do not have to tell the command map that the MakeHay notification triggers this command!</p>
<p>Right, do you mean you&#8217;ve avoided doing something like this?</p>
<p>commandMap.addCommand(MakeHay, MakeHayCommand);</p>
<p>Basically you&#8217;ve moved the MakeHay mapping from one place to another. In order to do that, you defined a new metadata tag, parsed it, and created an inability to use a command interface. Personally, I am reluctant to create new metadata when there&#8217;s a simple ActionScript equivalent, which is strongly typed and easier to debug.</p>
<p>&gt; My other main reason, was that it is felt familiar to most other command patterns I’ve worked with in the past</p>
<p>When I Google around and look at Wikipedia, I see predominantly execute().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-54</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Tue, 23 Mar 2010 08:29:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-54</guid>
		<description>hey Robert,

There are a couple of reason for having the notification as a parameter of the [Execute] method.  The most important is that it is used by dawn to automatically map the command class to the notification that triggers it.  Adding a command in dawn looks like this

commandMap.addCommand(MayHayCommand);

See how I do not have to tell the command map that the MakeHay notification triggers this command!  dawn performs reflection on the command, finds the type of the executes parameter and maps (via dawns notification bus) the command to that type. This not only removes a configuration step, it retains the type safety of the command.

If I was to inject the notification like a dependency of the command, how would dawn know which property to map the command to? (since notifications do not have to implement an interface or extend a type, they are just like any other object).

I also think it clearly distinguishes between something that is a dependency of the command and a payload that it can work on.

My other main reason, was that it is felt familiar to most other command patterns I&#039;ve worked with in the past (with the exception of robotlegs?).

thanks a lot
Sammy</description>
		<content:encoded><![CDATA[<p>hey Robert,</p>
<p>There are a couple of reason for having the notification as a parameter of the [Execute] method.  The most important is that it is used by dawn to automatically map the command class to the notification that triggers it.  Adding a command in dawn looks like this</p>
<p>commandMap.addCommand(MayHayCommand);</p>
<p>See how I do not have to tell the command map that the MakeHay notification triggers this command!  dawn performs reflection on the command, finds the type of the executes parameter and maps (via dawns notification bus) the command to that type. This not only removes a configuration step, it retains the type safety of the command.</p>
<p>If I was to inject the notification like a dependency of the command, how would dawn know which property to map the command to? (since notifications do not have to implement an interface or extend a type, they are just like any other object).</p>
<p>I also think it clearly distinguishes between something that is a dependency of the command and a payload that it can work on.</p>
<p>My other main reason, was that it is felt familiar to most other command patterns I&#8217;ve worked with in the past (with the exception of robotlegs?).</p>
<p>thanks a lot<br />
Sammy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Penner</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-53</link>
		<dc:creator>Robert Penner</dc:creator>
		<pubDate>Tue, 23 Mar 2010 01:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-53</guid>
		<description>Why don&#039;t you inject both the barn and note? Then you have a parameterless execute:

class MakeHayCommand{
   [Inject] public var barn:Barn;
   [Inject] public var note:MakeHay;

   [Execute] public function execute():void{
      barn.makeHay(note.howMuchHay);
   }
}</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t you inject both the barn and note? Then you have a parameterless execute:</p>
<p>class MakeHayCommand{<br />
   [Inject] public var barn:Barn;<br />
   [Inject] public var note:MakeHay;</p>
<p>   [Execute] public function execute():void{<br />
      barn.makeHay(note.howMuchHay);<br />
   }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-52</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Sun, 24 Jan 2010 11:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-52</guid>
		<description>Hey enzuguri,
really glad you are enjoying playing around with Dawn.  Let me know if you have any feedback.  I have had a look at parsley and it seems like a very solid, impressive framework, as does robotlegs!  I&#039;ve not really created Dawn to be the next big thing so am just happy people are finding it useful or fun :)
Cheers mate, Sam</description>
		<content:encoded><![CDATA[<p>Hey enzuguri,<br />
really glad you are enjoying playing around with Dawn.  Let me know if you have any feedback.  I have had a look at parsley and it seems like a very solid, impressive framework, as does robotlegs!  I&#8217;ve not really created Dawn to be the next big thing so am just happy people are finding it useful or fun <img src='http://www.ziazoo.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Cheers mate, Sam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: enzuguri</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-51</link>
		<dc:creator>enzuguri</dc:creator>
		<pubDate>Mon, 18 Jan 2010 14:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-51</guid>
		<description>Wow, seems like you&#039;ve put a lot of hard work in here, I checked out the source and am enjoying delving in and out of everything you&#039;ve done.

I just wondered if you&#039;ve ever taken a look at the parsley framework before?
http://www.spicefactory.org/parsley/docs/2.1/manual/

A lot of people are hyping this as the next big thing (especially as it seems to be part of the new caringorm spec), however I initially rejected it because of the heavy footprint for pure as projects.

Have you any plans to move the framework in this direction at all?

Thanks again, this looks very promising.</description>
		<content:encoded><![CDATA[<p>Wow, seems like you&#8217;ve put a lot of hard work in here, I checked out the source and am enjoying delving in and out of everything you&#8217;ve done.</p>
<p>I just wondered if you&#8217;ve ever taken a look at the parsley framework before?<br />
<a href="http://www.spicefactory.org/parsley/docs/2.1/manual/" rel="nofollow">http://www.spicefactory.org/parsley/docs/2.1/manual/</a></p>
<p>A lot of people are hyping this as the next big thing (especially as it seems to be part of the new caringorm spec), however I initially rejected it because of the heavy footprint for pure as projects.</p>
<p>Have you any plans to move the framework in this direction at all?</p>
<p>Thanks again, this looks very promising.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention commanding dawn « Sam's occasional tech thinkings -- Topsy.com</title>
		<link>http://www.ziazoo.co.uk/blog/2010/01/16/commanding-dawn/comment-page-1/#comment-50</link>
		<dc:creator>Tweets that mention commanding dawn « Sam's occasional tech thinkings -- Topsy.com</dc:creator>
		<pubDate>Sat, 16 Jan 2010 16:59:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.ziazoo.co.uk/blog/?p=245#comment-50</guid>
		<description>[...] This post was mentioned on Twitter by HowDo.us, sammyt123. sammyt123 said: just wrote a blog post on #dawns command pattern http://bit.ly/93kjhJ [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by HowDo.us, sammyt123. sammyt123 said: just wrote a blog post on #dawns command pattern <a href="http://bit.ly/93kjhJ" rel="nofollow">http://bit.ly/93kjhJ</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
