<?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: Cairngorm: One-to-One Events and Commands Doesn&#8217;t Make Sense</title>
	<atom:link href="http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/</link>
	<description>Rich Internet solutions utilizing Flex, ActionScript, JavaScript, Dojo, Objective-C, and the iPhone</description>
	<lastBuildDate>Mon, 17 May 2010 20:26:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: nuthell</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-15553</link>
		<dc:creator>nuthell</dc:creator>
		<pubDate>Tue, 30 Mar 2010 06:21:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-15553</guid>
		<description>http://nuthell.javaeye.com/admin/blogs/628150</description>
		<content:encoded><![CDATA[<p><a href="http://nuthell.javaeye.com/admin/blogs/628150" rel="nofollow">http://nuthell.javaeye.com/admin/blogs/628150</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nuthell</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-15552</link>
		<dc:creator>nuthell</dc:creator>
		<pubDate>Tue, 30 Mar 2010 06:21:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-15552</guid>
		<description>Guys , I have post a simple entry about how I deal with such problem.

here is the link.

My Email is 

nuthell at gmail dot com</description>
		<content:encoded><![CDATA[<p>Guys , I have post a simple entry about how I deal with such problem.</p>
<p>here is the link.</p>
<p>My Email is </p>
<p>nuthell at gmail dot com</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-489</link>
		<dc:creator>Jesse</dc:creator>
		<pubDate>Tue, 14 Oct 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-489</guid>
		<description>This is possible and common in Cairngorm. See the Cairngorm Store sample application.

The UpdateShoppingCartEvent uses multiple types which map to multiple commands in the controller. All of the other events are one-to-one.

I typically use one-to-one, but when it makes sense I use one-to-multiple.</description>
		<content:encoded><![CDATA[<p>This is possible and common in Cairngorm. See the Cairngorm Store sample application.</p>
<p>The UpdateShoppingCartEvent uses multiple types which map to multiple commands in the controller. All of the other events are one-to-one.</p>
<p>I typically use one-to-one, but when it makes sense I use one-to-multiple.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derrick Grigg</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-487</link>
		<dc:creator>Derrick Grigg</dc:creator>
		<pubDate>Mon, 04 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-487</guid>
		<description>Hey Kyle,

I use Cairngorm events structured like Flex events all time in my projects. I typically group them around a common value object or a common function. For instance to manage a user I would create a class called UserEvent. Within the UserEvent I would define the following events and also add a property to contain the &#039;user&#039;.

public static const addUser:String = &#039;ADD_USER&#039;;
public static const updateUser:String = &#039;UPDATE_USER&#039;;
public static const deleteUser:String = &#039;DELETE_USER&#039;;

public var user:UserVO;

Now I have a single UserEvent that gets registered against three different commands in my FrontController, one for each respective use case in the event. Always have a separate command for each use case, those things should not get combined.</description>
		<content:encoded><![CDATA[<p>Hey Kyle,</p>
<p>I use Cairngorm events structured like Flex events all time in my projects. I typically group them around a common value object or a common function. For instance to manage a user I would create a class called UserEvent. Within the UserEvent I would define the following events and also add a property to contain the &#8216;user&#8217;.</p>
<p>public static const addUser:String = &#8216;ADD_USER&#8217;;<br />
public static const updateUser:String = &#8216;UPDATE_USER&#8217;;<br />
public static const deleteUser:String = &#8216;DELETE_USER&#8217;;</p>
<p>public var user:UserVO;</p>
<p>Now I have a single UserEvent that gets registered against three different commands in my FrontController, one for each respective use case in the event. Always have a separate command for each use case, those things should not get combined.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hayes</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-488</link>
		<dc:creator>Kyle Hayes</dc:creator>
		<pubDate>Mon, 04 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-488</guid>
		<description>Derrick, you just described exactly what I am talking about above. Thank you! I suppose to each their own right? If I want to do it this way, I should be able to!

I completely agree about not combining commands. That takes away from the purpose of the command pattern in that each command should represent a single feature in the application.</description>
		<content:encoded><![CDATA[<p>Derrick, you just described exactly what I am talking about above. Thank you! I suppose to each their own right? If I want to do it this way, I should be able to!</p>
<p>I completely agree about not combining commands. That takes away from the purpose of the command pattern in that each command should represent a single feature in the application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josh</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-484</link>
		<dc:creator>josh</dc:creator>
		<pubDate>Sat, 26 Jan 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-484</guid>
		<description>Hey Kyle,

I suppose you dont have to make it a one to one relationship. Just have one userevent with different types of user events and then in your command execute method run a switch statement to determine which event is being sent and do some logic.  Now in that logic area is where will want to use classes as much as possible for reuse, you can also practice your design patterns here as well.

Hope that helps , I started doing this at work recently and now my command folder isn&#039;t as nearly as large.

PS: first time posting on your blog via my iPhone ;)</description>
		<content:encoded><![CDATA[<p>Hey Kyle,</p>
<p>I suppose you dont have to make it a one to one relationship. Just have one userevent with different types of user events and then in your command execute method run a switch statement to determine which event is being sent and do some logic.  Now in that logic area is where will want to use classes as much as possible for reuse, you can also practice your design patterns here as well.</p>
<p>Hope that helps , I started doing this at work recently and now my command folder isn&#8217;t as nearly as large.</p>
<p>PS: first time posting on your blog via my iPhone <img src='http://www.kylehayes.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hayes</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-485</link>
		<dc:creator>Kyle Hayes</dc:creator>
		<pubDate>Sat, 26 Jan 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-485</guid>
		<description>@josh - Hehe, about the iPhone...I feel special.

In regards to the switch statements in your commands, I don&#039;t know about that. The command pattern is meant to represent a single feature of the application. By adding in switch statements, it seems that you are bloating the patterns executable code. I don&#039;t have a problem with the command folder being large, it was this one event for every command thing that I thought was not well thought out.

Thanks for posting.</description>
		<content:encoded><![CDATA[<p>@josh &#8211; Hehe, about the iPhone&#8230;I feel special.</p>
<p>In regards to the switch statements in your commands, I don&#8217;t know about that. The command pattern is meant to represent a single feature of the application. By adding in switch statements, it seems that you are bloating the patterns executable code. I don&#8217;t have a problem with the command folder being large, it was this one event for every command thing that I thought was not well thought out.</p>
<p>Thanks for posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-486</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Sat, 26 Jan 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-486</guid>
		<description>Hey,
Ya adding more code in your executable method in the command will bloat the command, but you will have fewer commands for sure, if you did it right it wouldnt bloat it that much... depends on how many different types of UserEvents you had (aka. Add_User, Delete_User, Modify_User, etc...)

I dont think you can really get around the 1 to 1 relationship.  Even if you do UserEvent.ADD_USER and you also have a UserEvent.DELETE_USER, in the UserEvent class each event will still need seperate commands b/c each one will need to call a different delegate method to run the backend (server) logic.

You could get around the 1 to 1 logic by simply passing the event type to the delegate, which would call lets say a userService, and in that service it would call the correct ADD_USER CFC method to add a User based on the passed in event... likewise you could have a DELETE_USER cfc method that would delete the user if the delete event was passed in as a argument in the CFC... that make sense?  It basically makes your delegate really small for Users, and lets you have one User command, one User event and puts all the switching in your CFC to figure out which cfc function to call based on the passed in user event.  I thought about doing this once but never did it... figured I could live with a big command folder, one UserEvent, and my delegate just listed all my User Service methods.  

Also if you wanted to chain events this is a good post on how to do that:
http://cairngormdocs.org/blog/?p=27


Food for thought ;)  

Hows the new job? Ping me sometime lets chat.</description>
		<content:encoded><![CDATA[<p>Hey,<br />
Ya adding more code in your executable method in the command will bloat the command, but you will have fewer commands for sure, if you did it right it wouldnt bloat it that much&#8230; depends on how many different types of UserEvents you had (aka. Add_User, Delete_User, Modify_User, etc&#8230;)</p>
<p>I dont think you can really get around the 1 to 1 relationship.  Even if you do UserEvent.ADD_USER and you also have a UserEvent.DELETE_USER, in the UserEvent class each event will still need seperate commands b/c each one will need to call a different delegate method to run the backend (server) logic.</p>
<p>You could get around the 1 to 1 logic by simply passing the event type to the delegate, which would call lets say a userService, and in that service it would call the correct ADD_USER CFC method to add a User based on the passed in event&#8230; likewise you could have a DELETE_USER cfc method that would delete the user if the delete event was passed in as a argument in the CFC&#8230; that make sense?  It basically makes your delegate really small for Users, and lets you have one User command, one User event and puts all the switching in your CFC to figure out which cfc function to call based on the passed in user event.  I thought about doing this once but never did it&#8230; figured I could live with a big command folder, one UserEvent, and my delegate just listed all my User Service methods.  </p>
<p>Also if you wanted to chain events this is a good post on how to do that:<br />
<a href="http://cairngormdocs.org/blog/?p=27" rel="nofollow">http://cairngormdocs.org/blog/?p=27</a></p>
<p>Food for thought <img src='http://www.kylehayes.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   </p>
<p>Hows the new job? Ping me sometime lets chat.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alistair</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-481</link>
		<dc:creator>Alistair</dc:creator>
		<pubDate>Fri, 18 Jan 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-481</guid>
		<description>Yes, you could have UserEvent.ADD_USER, UserEvent.DELETE_USER etc as long as the event payload is then shared. That is, the member variables which hold the data for the event e.g. &#039;user name&#039; are shared across all the event types encapsulated inside the single UserEvent. No problem there. Where things start to fall apart are when the different operations require a different event payload. You can&#039;t have a single UserEvent and then stuff all the possible pieces of data into where some will be redundant depending on the &#039;type&#039;. This would be bad design and is probably the reason events and commands have a one to one relationship.</description>
		<content:encoded><![CDATA[<p>Yes, you could have UserEvent.ADD_USER, UserEvent.DELETE_USER etc as long as the event payload is then shared. That is, the member variables which hold the data for the event e.g. &#8216;user name&#8217; are shared across all the event types encapsulated inside the single UserEvent. No problem there. Where things start to fall apart are when the different operations require a different event payload. You can&#8217;t have a single UserEvent and then stuff all the possible pieces of data into where some will be redundant depending on the &#8216;type&#8217;. This would be bad design and is probably the reason events and commands have a one to one relationship.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenneth Lejnieks</title>
		<link>http://www.kylehayes.info/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense/comment-page-1/#comment-482</link>
		<dc:creator>Kenneth Lejnieks</dc:creator>
		<pubDate>Fri, 18 Jan 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2008/01/17/Cairngorm-OnetoOne-Events-and-Commands-Doesnt-Make-Sense#comment-482</guid>
		<description>I usually end up doing something like this:

public class SomeEvent extends CairngormEvent
{

public static const ACTION_A:String = &quot;ACTION_A&quot;;
public static const ACTION_B:String = &quot;ACTION_B&quot;;
public static const ACTION_B:String = &quot;ACTION_B&quot;;


public function SomeEvent(...


then call it this way 
var someEvent:SomeEvent = new SomeEvent( SomeEvent.ACTION_B, ...</description>
		<content:encoded><![CDATA[<p>I usually end up doing something like this:</p>
<p>public class SomeEvent extends CairngormEvent<br />
{</p>
<p>public static const ACTION_A:String = &quot;ACTION_A&quot;;<br />
public static const ACTION_B:String = &quot;ACTION_B&quot;;<br />
public static const ACTION_B:String = &quot;ACTION_B&quot;;</p>
<p>public function SomeEvent(&#8230;</p>
<p>then call it this way<br />
var someEvent:SomeEvent = new SomeEvent( SomeEvent.ACTION_B, &#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
