<?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>shaun smith &#187; crybaby</title>
	<atom:link href="http://shaun.boyblack.co.za/blog/tag/crybaby/feed/" rel="self" type="application/rss+xml" />
	<link>http://shaun.boyblack.co.za/blog</link>
	<description>Flash, Flex, Ruby - Cape Town, SA</description>
	<lastBuildDate>Wed, 08 Sep 2010 17:56:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Linking to your GitHub code</title>
		<link>http://shaun.boyblack.co.za/blog/2010/08/19/linking-to-your-github-code/</link>
		<comments>http://shaun.boyblack.co.za/blog/2010/08/19/linking-to-your-github-code/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 22:33:17 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Banter]]></category>
		<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[crybaby]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=931</guid>
		<description><![CDATA[It&#8217;s pretty easy to link directly to a line of code in your GitHub repo: robotlegs/robotlegs-framework/blob/master/src/org/robotlegs/core/IContextProvider.as#L16 Don&#8217;t do that you naughty sausage! Your codebase will evolve (if all goes well), and line 16 will be replaced by a newer, shinier string of characters. Or, in this case, it&#8217;ll point to something that no longer exists. [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s pretty easy to link directly to a line of code in your <a title="GitHub" href="http://github.com/">GitHub</a> repo:</p>
<p><a href="http://github.com/robotlegs/robotlegs-framework/blob/master/src/org/robotlegs/core/IContextProvider.as#L16">robotlegs/robotlegs-framework/blob/<strong>master</strong>/src/org/robotlegs/core/IContextProvider.as#L16</a></p>
<p><strong>Don&#8217;t do that you naughty sausage!</strong> Your codebase will evolve (if all goes well), and line 16 will be replaced by a newer, shinier string of characters. Or, in this case, it&#8217;ll point to something that no longer exists.</p>
<p>This, on the other hand, is more likely to stick around to haunt its author (me):</p>
<p><a href="http://github.com/robotlegs/robotlegs-framework/blob/v1.1.2/src/org/robotlegs/core/IContextProvider.as#L16">robotlegs/robotlegs-framework/blob/<strong>v1.1.2</strong>/src/org/robotlegs/core/IContextProvider.as#L16</a></p>
<p>Select a tag before you link to your fancy code (&#8220;Switch Tags&#8221; under <a title="GitHub" href="http://github.com/">GitHub</a>&#8216;s &#8220;Source&#8221; menu).</p>
<p><img class="alignnone size-full wp-image-941" title="GitHub_Tags_435" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2010/08/GitHub_Tags_435.png" alt="" width="435" height="250" /></p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2010/08/19/linking-to-your-github-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Is RobotLegs?</title>
		<link>http://shaun.boyblack.co.za/blog/2009/09/07/wtf-is-robotlegs/</link>
		<comments>http://shaun.boyblack.co.za/blog/2009/09/07/wtf-is-robotlegs/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 20:16:18 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[crybaby]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=789</guid>
		<description><![CDATA[What? RobotLegs is an Architectural (or Structural) Action Script 3 Framework. It provides a mechanism for wiring objects together. It promotes a usage pattern for keeping your code loosely coupled and easy to test. It has a narrow scope: wiring. How? RobotLegs relies on two things fairly unique to the Flash Platform: A powerful, built-in, [...]]]></description>
			<content:encoded><![CDATA[<h3>What?</h3>
<ul>
<li><a title="RobotLegs AS3" href="http://wiki.github.com/darscan/robotlegs">RobotLegs</a> is an Architectural (or Structural) Action Script 3 Framework.</li>
<li>It provides a mechanism for wiring objects together.</li>
<li>It promotes a usage pattern for keeping your code loosely coupled and easy to test.</li>
<li>It has a narrow scope: wiring.</li>
</ul>
<p><span id="more-789"></span></p>
<h3>How?</h3>
<p>RobotLegs relies on two things fairly unique to the Flash Platform: A powerful, built-in, standardised Event Model, and a Display List that is 100% integrated with that Event Model.</p>
<h3>Why?</h3>
<p>Using these two things (and any compliant Dependency Injection framework) RobotLegs is able to offer a minimally invasive solution for wrapping an application around a display object hierarchy &#8211; even if you don&#8217;t have access to modify the Classes within that hierarchy. Depending on your style, this may be hugely advantageous.</p>
<h3>But What About The Lolrus?</h3>
<p>Swiz, Parsley, Mate, PureMVC, HydraMVC and Cairngorm exist to solve the same basic problem, <span style="text-decoration: line-through;">but they suffer from blurry scopes and/or poor implementations</span>.(*) Here are some initial thoughts on that: <a title="Another Framework, Oh Noes!" href="http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/">http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/</a></p>
<p>Some may defend their violations, claiming pragmatism over purism &#8211; that is dangerous: the library that you use to wire your application together directly affects the flexibility and, more importantly, testability of your code. I am being pragmatic: if my Classes are hard to test (Singletons, Statics) then my application will be fragile and I won&#8217;t be free to refactor with speed and confidence. If code can&#8217;t be refactored easily it is dead. If I can&#8217;t refactor my code easily my progress as a developer slows down drastically.</p>
<h3>So, Is RobotLegs Perfect?</h3>
<p>Well no, but it does everything that it&#8217;s advertised to do, and tests are being set up to ensure that it stays that way. A framework must pick it&#8217;s battles carefully. There are one or two things that need some very careful consideration before RobotLegs can reach 1.0</p>
<p>Also, some peer review would be nice. I&#8217;m a mediocre programmer at best. I&#8217;m on that part of the curve where I&#8217;m knowledgeable enough to know exactly how bad I am.</p>
<h3>Where Is The Website? OMG, Where Are The Docs?</h3>
<p>I thought it would be best to determine whether or not I have completely missed the point before investing time and energy into support artifacts.</p>
<p><img class="alignnone size-full wp-image-803" title="lulzorsomgrofls2" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/09/lulzorsomgrofls2.jpg" alt="lulzorsomgrofls2" width="350" height="350" /></p>
<h3>Dude, You&#8217;re Wearing Sunglasses Indoors. WTF?</h3>
<p>So, have I missed the point? Do you really think that ANY of the architectural frameworks out there are good enough?</p>
<p>(*) Actually, it&#8217;s not really that, it&#8217;s more about how your application code looks when written on top of these frameworks.</p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2009/09/07/wtf-is-robotlegs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>RobotLegs Updates, Demos and Unit Testing</title>
		<link>http://shaun.boyblack.co.za/blog/2009/08/01/robotlegs-updates-demos-and-unit-testing/</link>
		<comments>http://shaun.boyblack.co.za/blog/2009/08/01/robotlegs-updates-demos-and-unit-testing/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 14:17:51 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[crybaby]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=737</guid>
		<description><![CDATA[Things have been rolling along quite nicely on the RobotLegs front lately. Joel Hooks put together two useful examples, check &#8216;em out: RobotLegs Image Gallery Demo RobotLegs and FlexUnit 4 I&#8217;ve also pushed out quite a couple of framework updates (currently at v0.6): Mediator onRegisterComplete hook -&#62; onRegister (for those coming from PureMVC) Spring ActionScript [...]]]></description>
			<content:encoded><![CDATA[<p>Things have been rolling along quite nicely on the <a title="RobotLegs AS3" href="http://shaun.boyblack.co.za/blog/robotlegs-as3/">RobotLegs</a> front lately. <a title="Joel Hooks | Building Blocks" href="http://joelhooks.com/">Joel Hooks</a> put together two useful examples, check &#8216;em out:</p>
<ul>
<li><a href="http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%E2%80%93-inspired-by-puremvc/">RobotLegs Image Gallery Demo</a></li>
<li><a href="http://joelhooks.com/2009/07/21/unit-testing-with-inversion-of-control-ioc-and-dependency-injection-di-with-the-robotlegs-framework-and-flexunit-4/">RobotLegs and FlexUnit 4</a></li>
</ul>
<p><span id="more-737"></span>I&#8217;ve also pushed out quite a couple of <a title="RobotLegs Commits" href="http://github.com/darscan/robotlegs/commits/master">framework updates</a> (currently at v0.6):</p>
<ul>
<li>Mediator onRegisterComplete hook -&gt; onRegister (for those coming from <a title="PureMVC" href="http://puremvc.org">PureMVC</a>)</li>
<li><a title="Spring ActionScript" href="http://www.springactionscript.org/">Spring ActionScript</a> adapters (as an alternative to <a title="SmartyPants IoC" href="http://code.google.com/p/smartypants-ioc/">SmartyPants-IOC</a>)</li>
<li>Namespace changed to org.robotlegs.*</li>
<li>Logging now uses <a title="AS3 Commons Logging" href="http://www.as3commons.org/as3-commons-logging/index.html">as3commons-logging</a></li>
</ul>
<p>That last change means that RobotLegs is now dependent on the <a title="AS3 Commons" href="http://www.as3commons.org/">AS3 Commons</a> logging library. It also means that RobotLegs logging is now standard, and can be easily configured or turned off. Try it out with the <a href="http://solutions.powerflasher.com/products/sosmax/">PowerFlasher SOS Max tool</a>.</p>
<h3>Module Demo</h3>
<p>I&#8217;ve started putting together another Flex example, called the Acme Widget Factory, which can be found here:</p>
<p><a title="RobotLegs Demos" href="http://github.com/darscan/robotlegsdemos/tree/master">RobotLegs Demos on GitHub</a></p>
<p>The demo is a little convoluted, but exists to illustrate a couple of things:</p>
<ul>
<li>Working with Flex Modules</li>
<li>Communicating between Contexts via Interfaces and Events</li>
<li>An alternative to Named Proxies</li>
</ul>
<p>The demo only works with the <a title="Spring ActionScript" href="http://www.springactionscript.org/">Spring ActionScript</a> adapters for now &#8211; due to what I believe to be a bug in SmartyPants (but I haven&#8217;t had time to build isolated tests to prove this).</p>
<p>The Module side of things needs a little more thought, but I think it is fairly clean and usable for the time being.</p>
<h3>Review</h3>
<p>As Joel mentions in one of his posts, RobotLegs hasn&#8217;t had much peer review. This is very true, and needs to be remedied (besides, I&#8217;m DYING for some technical feedback!). I have some theories as to why this is:</p>
<ol>
<li>Some developers <a href="http://www.techper.net/2008/10/05/4-things-to-hate-about-puremvc/">really dislike</a> PureMVC (probably for many of the same <a href="http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/">reasons that I started RobotLegs</a> in the <a href="http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/">first place</a>) and so have disregarded RobotLegs because it can be viewed as a rebuild of PureMVC.</li>
<li>Many Flex developers who work on large enterprise applications seem to dislike the idea of using 3rd party Architectural Frameworks, preferring to hand-roll their own solutions on a per-project basis.</li>
<li>Dependency Injection sounds complicated to developers who are new to the pattern.</li>
<li>Many intermediate Flash developers have only just started getting into PureMVC. It will take some time for them to fully understand it&#8217;s strengths and weaknesses.</li>
<li>Experienced developers, on the other hand, are probably bored of the whole &#8220;Architectural Framework&#8221; trip, and are tired of trying out new frameworks. By now they&#8217;ve picked their favorite, learned how to be really productive with it, and have built code-generators and other such tools to work around the bad/boring parts of their chosen framework.</li>
<li>Setter injection turns some people off.. <a href="http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/">which it shouldn&#8217;t</a>.</li>
<li>I&#8217;m not very &#8220;connected&#8221; in the developer circles. RobotLegs is my first Open Source project, and is the first time I&#8217;ve really put myself &#8220;out there&#8221;. I don&#8217;t have a very impressive online portfolio &#8211; the portfolio pieces on my blog are mostly just the small things (often built for friends) that I&#8217;m allowed to list publicly.</li>
</ol>
<p>If you are an experienced Flash/Flex developer, and can bring yourself to review yet another framework, I would love to get some technical feedback on RobotLegs as a framework. Harsh criticism welcome.</p>
<p>And remember, <a href="http://github.com/darscan/robotlegs/tree/master">RobotLegs is on GitHub</a> &#8211; if you like some of it, but want to change other bits, all you have to do is click that little &#8220;fork&#8221; button and go crazy. <a href="http://git-scm.com/">Git</a> For The Win!</p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2009/08/01/robotlegs-updates-demos-and-unit-testing/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Another Architectural Framework, But Why?</title>
		<link>http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/</link>
		<comments>http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 12:47:15 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Banter]]></category>
		<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[crybaby]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[smartypants-ioc]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=406</guid>
		<description><![CDATA[The State Of The Game There are some great Flash and Flex application frameworks out there right now. Mate, Swiz and PureMVC (update: and Parsley!) stand out. The authors of these frameworks realized that the Flash Platform is different enough to the JVM to warrant a fresh approach to application design. Someone mentioned recently that [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-458" title="robotlegssketchsmall" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/04/robotlegssketchsmall.gif" alt="robotlegssketchsmall" width="221" height="260" /></p>
<h2>The State Of The Game</h2>
<p>There are some great Flash and Flex application frameworks out there right now. <a title="Mate Flex Framework" href="http://mate.asfusion.com/">Mate</a>, <a title="The Swiz Framework" href="http://code.google.com/p/swizframework/">Swiz</a> and <a title="PureMVC Flash and Flex Framework" href="http://puremvc.org/">PureMVC</a> (update: and <a title="Parsley" href="http://www.spicefactory.org/parsley/">Parsley</a>!) stand out. The authors of these frameworks realized that the Flash Platform is different enough to the <a title="The Java Virtual Machine" href="http://en.wikipedia.org/wiki/Java_Virtual_Machine">JVM</a> to warrant a fresh approach to application design.</p>
<p><span id="more-406"></span>Someone mentioned recently that for such a young language (referring to Action Script 3), it&#8217;s quite surprising how many frameworks have sprung up around it. I&#8217;m not surprised at all: rich internet application development is complicated.. and it&#8217;s a pretty recent field in the grand scheme of things. It brings new (and often subtle) twists to traditional web and desktop software development. Writing elegant, maintainable code is hard enough as it is, but doing so on a rapidly evolving, heavily interactive platform.. well, people are still working on the best way to approach that (unless I missed the big news &#8211; in which case you can stop reading right here).</p>
<p>Hence all the groovy new architectural frameworks popping up. They share some common goals:</p>
<ol>
<li>Help developers write good, clean, understandable, testable, maintainable code</li>
<li>Help them write that code faster</li>
<li>Provide an easy-to-use mechanism for application/context/module subsystem inter-communication</li>
<li>Provide an easy-to-use mechanism for wiring distinct parts of the application together whilst keeping those parts loosely coupled</li>
</ol>
<p>And they succeed. To various degrees. I think they&#8217;re all pretty cool.</p>
<p><img class="alignnone size-full wp-image-439" title="scenery" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/04/scenery.gif" alt="scenery" width="450" height="370" /></p>
<h2>A Poke In The Back With A Sharp Stick</h2>
<h3>So why build another one?</h3>
<ol>
<li>For fun &#8211; it&#8217;s how I learn stuff</li>
<li>Because I find the other frameworks critically flawed</li>
</ol>
<h3>What kind of &#8220;critical&#8221; flaws?</h3>
<ol>
<li>Singletons (big &#8220;S&#8221;)</li>
<li>Central/Static Event Dispatchers</li>
<li>Using the Display List as an Application Event Bus</li>
<li>Casting</li>
<li>The Service/Model Locator Pattern</li>
<li>The Presenter Pattern</li>
<li>Injecting into View Components</li>
</ol>
<h3>And what&#8217;s wrong with those things?</h3>
<p>They are bad ideas:</p>
<h4>1. The Singleton &#8211; Bad Idea</h4>
<p>The standard <a href="http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/">Singleton</a> <a href="http://misko.hevery.com/2008/08/21/where-have-all-the-singletons-gone/">implementation</a> (that static getInstance method) <a href="http://misko.hevery.com/2008/08/25/root-cause-of-singletons/">is</a> <a href="http://tech.puredanger.com/2007/07/03/pattern-hate-singleton/">severely</a> <a href="http://c2.com/cgi/wiki?SingletonsAreEvil">flawed</a>. Unless you are writing device drivers, there is almost no excuse to touch a Singleton with a sharp stick.</p>
<p>Singletons bring bags of hurt to frameworks and applications.. suddenly, trying to build a modular application becomes an overly complicated affair, and unit testing becomes a nightmare. Singletons are viruses &#8211; they infect every class they touch.</p>
<p>And Multitons? If Singletons are evil, Multitons are diabolically evil. What makes the Multiton pattern incredible is that it manages to chump the Singleton as the worst Design Pattern Of All Time &#8211; no easy feat, and certainly the work of an evil genius with a wicked sense of humour. Not only do we have all the problems of the classic Singleton, we throw a poorly designed Model Locator into the mix &#8211; to pull out these horrendous Singletons we now need to use String keys.</p>
<p>Contextual singletons (as made possible by Dependency Injection frameworks) are a much nicer solution, they don&#8217;t require any extra (fluffy, nonsense, ill placed) code on the target classes themselves, and they allow identical applications/modules to exist side-by-side in the Virtual Machine without fighting and mass confusion. Which leads me to..</p>
<h4>2. Central/Static Event Dispatchers &#8211; Bad Idea</h4>
<p>As convenient as it is to use, a Central Dispatcher is a really bad idea. Another Singleton effectively. Pop two apps into the same SWF and watch, with excitement and glee, all the cross-talk that occurs &#8211; both apps responding to each other&#8217;s events. Oh noes!</p>
<p>Architectural frameworks generally provide you with an application event bus/channel/dispatcher to &#8220;chat&#8221; on, but this should be localised to the application itself (or some other context). Which leads me to&#8230;</p>
<h4>3. Using the Display List as an Application Event Bus &#8211; Bad Idea</h4>
<p>I find this one fairly disturbing too: dispatching system/application events along the display list. No!</p>
<p>A View is just that: &#8220;<strong>A</strong> view&#8221;, not &#8220;<strong>The</strong> view&#8221;. And don&#8217;t get me started on those innocent looking Event Maps! No, let&#8217;s move along&#8230;</p>
<h4>4. Casting &#8211; Bad Idea</h4>
<p>Besides wasting space and annoying programmers, casting distributes knowledge throughout a system &#8211; casting requires that you look elsewhere in your codebase for the &#8220;real&#8221; type.</p>
<p>And it weakens our lovely compile-time type checking (albeit temporarily), sending us back in time to our unhappy days building complex applications in the Flash IDE. And it&#8217;s boring. And it often occurs because of..</p>
<h4>5. The Service/Model Locator Pattern &#8211; Bad Idea</h4>
<p>Classes should not be responsible for &#8220;fetching&#8221; their dependencies &#8211; this is a separate responsibility that belongs somewhere else entirely &#8211; they should only contain code for doing their job. When classes reach outside to fetch things from the application/context they sneakily hide their dependencies away from the outside world.</p>
<p>Unit testers will despise you (which is a serious problem if you are writing your own tests) because it becomes incredibly hard to figure out how much set up needs to be done to write even the smallest of tests. You have to look inside the class for any calls to the Service Locator to find your direct dependencies, and then you have to look inside each of those classes to find theirs and so on. No no, that&#8217;s just cruel.</p>
<h4>6. The Presenter Pattern &#8211; Bad Idea</h4>
<p>Ok, it&#8217;s going to be tricky to back this one up. But think about it this way: the Presenter pattern requires that you modify your View component (to add a reference to a Presenter). Not a biggie, but once you&#8217;ve done that you&#8217;ve started coupling your View component to your application/context &#8211; a slippery slope.</p>
<p>I think the Mediator pattern is a much better fit for Flash and it&#8217;s Display List, and even more-so when it comes to Flex (and other UI frameworks with complex component life cycles).</p>
<p>It is far easier and cleaner to &#8220;wrap&#8221; around view components and poke their APIs than to have to modify (extend) them to make space for their Presenter references. Leave those components alone, leave them to the component developers, you&#8217;re supposed to be writing an application. While we&#8217;re on the Presenter pattern, let&#8217;s take a look at something dirty one might do in an attempt to salvage it&#8217;s reputation..</p>
<h4>7. Injecting into View Components &#8211; Bad Idea</h4>
<p>Besides being incredibly slow and wasteful (especially for Flex UIComponents), injecting directly into a View component couples it to your application/context.</p>
<p>View components, with any hope for reuse, should be as self-contained as possible. They should expose an API and dispatch Events. They shouldn&#8217;t be dependent on the application they are in or the framework it happens to be using. Give &#8216;em ViewModels (M-V-VM) if you must, but don&#8217;t go and couple those ViewModels to your application, and certainly don&#8217;t inject them.</p>
<p><img class="alignnone size-full wp-image-467" title="ducksaysyuk1" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/04/ducksaysyuk1.gif" alt="ducksaysyuk1" width="450" height="632" /></p>
<h2>Wrapping Up This Micro-Post</h2>
<h4>Well that&#8217;s just your opinion, dude</h4>
<p>Yeh, but I&#8217;m pretty proud of my little 7 point list there (cos I&#8217;m an OOP noob, and this stuff gets me amped). Using Dependency Injection I was able to avoid all those nasty things when building my own PureMVC-like framework.</p>
<h4>But that just shifts the problem somewhere else</h4>
<p>Yes, somewhere more appropriate.</p>
<p>Besides some convenient implementations (in the mvcs package), and some marker interfaces (in the core package) <a title="RobotLegs AS3 - DI Driven MVCS Framework for Flash and Flex" href="http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/">RobotLegs</a> essentially provides two things:</p>
<ol>
<li>A Command Factory &#8211; for binding Commands to Events, and</li>
<li>A Mediator Factory &#8211; for handling automatic Mediator creation and registration</li>
</ol>
<p>Everything else is handled by a Dependency Injection framework and an Event Dispatcher.</p>
<p><img class="alignnone size-full wp-image-459" title="theendissmall" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/04/theendissmall.gif" alt="theendissmall" width="225" height="152" /></p>
<p><strong>Note</strong>: If you&#8217;ve been through all this before, I apologise, it&#8217;s new to me.. I&#8217;m a little slow.</p>
<p><strong>Beware</strong>: the current default implementation of <a title="RobotLegs AS3" href="http://shaun.boyblack.co.za/blog/robotlegs-as3/">RobotLegs</a> makes use of annotated setter injection. This breaks encapsulation, is open to misuse, and runs the risk of leaving objects in partially initialised states, but it&#8217;s very convenient! You can swap out SmartyPants-IOC for a Dependency Injection framework that performs constructor injection if you really want to play it safe.</p>
<p><strong>I&#8217;ll admit straight-up</strong> (albeit as a footnote) that I never really gave Cairngorm much of a chance &#8211; preliminary research led me to demos, documentation and diagrams that screamed poor design and foreshadowed immense struggle. I&#8217;m sure there is a way to build a well designed Cairngorm application, but it looks like it&#8217;d take an awful amount of effort.. and code. And it probably wouldn&#8217;t be very much fun.</p>
<p><strong>UPDATE</strong>: Removed some words that made me sound like a douche bag.</p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
	</channel>
</rss>
