<?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; swiz</title>
	<atom:link href="http://shaun.boyblack.co.za/blog/tag/swiz/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>Robotliz &#8211; Using Robotlegs like Swiz in 20 minutes</title>
		<link>http://shaun.boyblack.co.za/blog/2009/11/10/robotliz-using-robotlegs-like-swiz-in-20-minutes/</link>
		<comments>http://shaun.boyblack.co.za/blog/2009/11/10/robotliz-using-robotlegs-like-swiz-in-20-minutes/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 07:21:20 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[swiz]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=863</guid>
		<description><![CDATA[Warning: The style of architecture demonstrated in this video is not sexy. Nor is it in any way recommended. Also, I cheat by eating plenty copy-pasta, and I say &#8220;um&#8221; a LOT. I&#8217;m still trying to figure about the best way to illustrate the simplicity and flexibility of the Robotlegs framework. In the meantime however, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Warning:</strong> <em>The style of architecture demonstrated in this video is not sexy. Nor is it in any way recommended. Also, I cheat by eating plenty copy-pasta, and I say &#8220;um&#8221; a LOT.</em></p>
<p>I&#8217;m still trying to figure about the best way to illustrate the simplicity and flexibility of the Robotlegs framework. In the meantime however, I thought I&#8217;d respond to <a title="Swiz in 20 minutes" href="http://www.firemoss.com/index.cfm/2009/10/21/Swiz-in-20-minutes-video--byebye-boilerplate">this cool Swiz video</a> by doing the same thing with <a title="Robotlegs AS3" href="http://www.robotlegs.org/">Robotlegs</a> &#8211; except ending up with a modular (as opposed to a static) app, and throwing in some git/<a title="GitHub - Social Coding" href="http://github.com/">GitHub</a> love as a bonus.</p>
<p>I don&#8217;t have a nice mic, so I strapped a phone to the side of my head and left myself a really long voicemail. Anyhoo:</p>
<p><a title="Robotlegs Swizzle on Vimeo" href="http://www.vimeo.com/7524637"><img class="alignnone size-full wp-image-868" title="RobotlegsVimeo" src="http://shaun.boyblack.co.za/blog/wp-content/uploads/2009/11/RobotlegsVid.jpg" alt="RobotlegsVimeo" width="450" height="265" /></a></p>
<p>You can grab the (terrible) source over at:</p>
<p><a title="SillyStockPriceExample demo app" href="http://github.com/darscan/SillyStockPriceExample">http://github.com/darscan/SillyStockPriceExample</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2009/11/10/robotliz-using-robotlegs-like-swiz-in-20-minutes/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>AS3 Dependency Injection and [Autowire]</title>
		<link>http://shaun.boyblack.co.za/blog/2009/03/13/as3-dependency-injection-and-autowire/</link>
		<comments>http://shaun.boyblack.co.za/blog/2009/03/13/as3-dependency-injection-and-autowire/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 13:33:24 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Banter]]></category>
		<category><![CDATA[Pijin]]></category>
		<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[mate]]></category>
		<category><![CDATA[puremvc]]></category>
		<category><![CDATA[smartypants-ioc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[swiz]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=204</guid>
		<description><![CDATA[Warning: This is long and probably VERY boring.. unless you are an AS3 junkie, and you&#8217;re interested in so called &#8220;lightweight micro-architectural frameworks&#8221; for Flash and Flex. A couple of weeks ago I played around with Mate and Swiz. I already knew a little about Dependency Injection (in theory anyway), but playing with those two [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Warning</strong>: This is long and probably VERY boring.. unless you are an AS3 junkie, and you&#8217;re interested in so called &#8220;lightweight micro-architectural frameworks&#8221; for Flash and Flex.</p>
<p>A couple of weeks ago I played around with <a title="Mate Flex Framework" href="http://mate.asfusion.com/" target="_blank">Mate</a> and <a title="Swiz Flex Framework" href="http://code.google.com/p/swizframework/" target="_blank">Swiz</a>. I already knew a little about Dependency Injection (in theory anyway), but playing with those two frameworks really drove the point home: applications are potentially MUCH easier to write, and much more flexible, when you take advantage of Dependency Injection.<span id="more-204"></span></p>
<p>If you&#8217;ve used <a title="PureMVC Framework" href="http://puremvc.org/" target="_blank">PureMVC</a> you might be familiar with writing code like this:</p>
<p>var myProxy:MyProxy = facade.retrieveProxy(MyProxy.NAME) as MyProxy;<br />
myProxy.doSomethingAwesome();</p>
<p>This is sometimes referred to as the Model or Service Locator pattern. Firstly, it&#8217;s a little tedious to write. But more importantly, it puts the responsibility on your class to &#8220;fetch&#8221; the things it needs &#8211; not a good thing (especially from a testing point of view). From the &#8220;outside&#8221; you can&#8217;t see what your class is dependant on: you have to review the actual code in your class to see what it wants to pull in from the outside world.</p>
<p>It&#8217;s also a bit sneaky: to get something out, you have to know how it was put in &#8211; splitting and spreading knowledge across your codebase. Not pleasant.</p>
<p>Alternatively, you could use a Singleton to hang all your objects on. That would not be cool: <a title="Singletons are Pathological Liars" href="http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/" target="_blank">link</a>, <a title="Where Have All the Singletons Gone?" href="http://misko.hevery.com/2008/08/21/where-have-all-the-singletons-gone/" target="_blank">link</a>, <a title="Root Cause of Singletons" href="http://misko.hevery.com/2008/08/25/root-cause-of-singletons/" target="_blank">link</a>.</p>
<p><strong>Enter Dependency Injection</strong></p>
<p>Another solution is to declare certain properties on your class as dependencies to be &#8220;given&#8221; to you on (or just after) construction. A Dependency Injection framework will take care of managing these dependencies and providing you with what you need. Your class can then focus on doing it&#8217;s job instead of worrying about how to get the objects it needs.</p>
<p><strong>I Like The Mediator Pattern</strong></p>
<p>And I like the concepts in PureMVC: Specifically the Mediator, Command and Proxy patterns. I like clean view components with absolutely no framework or application code in them &#8211; as made possible by the Mediator pattern. I like Commands and I like binding them to system events. I like Proxies, who only communicate outwards, by dispatching events, and who&#8217;s APIs must be accessed directly by Commands and/or Mediator instances.</p>
<p>But I don&#8217;t like the use of Singletons or Multitons, the Service/Model locator pattern, the spreading of knowledge throughout the system by the Mediator and Proxy registration and retrieval mechanism (you have to know how something was put in to get it out again), and the custom Notification scheme and it&#8217;s associated methods: listNotificationInterests and handleNotification (with that nasty switch!).</p>
<p>So, I like PureMVC, I just think it could be improved for certain use cases. Now, obviously, improvement is subjective. Designing a framework is largely a balancing act: every decision has a pro and a con, and the framework architect must weigh up the pros and cons to steer the project in a chosen direction. That direction is determined by the architects vision of the most important use cases for the framework. I think that PureMVC has been brilliantly designed when stacked against it&#8217;s objectives. It&#8217;s been very carefully thought through, has an amazing author and community, sports great documentation, examples and utilities, and does it&#8217;s job well.</p>
<p><strong>YALMAFRIA (Yet Another Lightweight Micro-Architecture For Rich Internet Applications)</strong></p>
<p>Mate and Swiz can both do Dependency Injection. What I found interesting about the Dependency Injection in Mate is that it&#8217;s event based &#8211; this allows you to look at the event target to determine the instance that is currently being injected into. Using that (and a thing called an Object Builder in Mate) I was able to configure my application to automatically create Mediators for view components as they arrived on stage, and set references to the view components on the newly created Mediators.</p>
<p>It worked, but it seemed a little klunky, and still required a fair amount of code to map a Mediator Class to a view component Class (and any other dependencies). Regardless, it got me amped &#8211; using Dependency Injection and automatic Mediator registration I could remove most of the boring (and brittle) code from my projects.</p>
<p>I decided not to use Swiz or Mate in the end. Both offer nice solutions to some of the challenges of building RIA applications, but neither would make building my current application any quicker or easier.</p>
<p>Besides: I didn&#8217;t like the idea of using the display list as a system event channel, as in the case of Mate, or the concept of a central (Singleton) event dispatcher, as in the case of Swiz. And I didn&#8217;t want to put ANY application or framework code into my view components, as both seem to encourage.</p>
<p>Also, I wanted a framework that I could use for both Flex AND plain AS3 projects. I believe that this is possible with Swiz, but certainly not with Mate.</p>
<p>So, I looked for an AS3 Dependency Injection library to build a(nother) micro-architectural framework on top of..</p>
<p><strong>Back to Dependency Injection</strong></p>
<p>I tried <a title="Spring ActionScript" href="http://www.pranaframework.org/" target="_blank">Spring ActionScript</a> (previously known as Prana) first. Immediately, two things bugged me about it: the use of external xml files to configure dependencies, and the side-effect of that requirement:</p>
<p>When compiling a SWF the compiler ignores Class definitions that are not directly referenced by the application. A small problem, easily solved, but an extra step none the less to ensure all necessary Classes are compiled. Loading your dependencies externally is groovy, fo sho, but I really don&#8217;t need that right now.</p>
<p>I believe you&#8217;d enjoy Spring ActionScript if you&#8217;re from Java land (hello there, have you played with <a title="Clojure" href="http://clojure.org/" target="_blank">Clojure</a> yet? it got me all jazzed for a spell.. even though I didn&#8217;t build anything useful with it).</p>
<p>Anyhoo.. check this out if you are interested in Spring ActionScript and Autowiring: <a title="The “Spring ActionScript” Framework – Part 2: Autowiring" href="http://coenraets.org/blog/2009/03/the-spring-actionscript-framework-%E2%80%93-part-2-autowiring/" target="_blank">link</a></p>
<p>Or this, if you want to see how to do a similar thing with Swiz: <a title="A lovely little framework called Swiz" href="http://aralbalkan.com/1960" target="_blank">link</a></p>
<p><strong>Inspired by Guice</strong></p>
<p>Next I checked out <a title="SmartyPants-IOC Dependency Injection Framework" href="http://code.google.com/p/smartypants-ioc/" target="_blank">SmartyPants-IOC</a>. I liked the vibe and proceeded to build my little framework with it.</p>
<p><strong>RobotLegs AS3<br />
</strong></p>
<p>I decided to call my framework RobotLegs. It&#8217;s very simple really. It contains two factories (and some Interfaces):</p>
<p>A Mediator Factory &#8211; for automatically creating and wiring up Mediators as view components arrive on Stage.</p>
<p>And a Command Factory &#8211; for binding commands to events.</p>
<p>Everything else is handled by Dependency Injection thanks to SmartyPants. Conceptually, the framework is much the same as PureMVC, but uses DI in place of a registry, and built-in Flash Events instead of Notifications.</p>
<p>I was able to migrate my current project over to Robot Legs (from PureMVC) in about a day. Not bad considering there were dozens of Commands, over 20 Mediators and around 10 Proxies to convert. It was a bit of a mission creating all the custom Event Classes to replace my Notifications though.</p>
<p>But it was certainly worth it. My application code has tidied up nicely. Many of my Mediators, Proxies and Commands have halved in size, due to the removal of lookup code and notification body casting.</p>
<p><strong>RobotLegs?</strong></p>
<p>The cool thing about Mediators that automatically wrap themselves around view components as they appear is that it greatly simplifies dealing with composite, lazily instantiated view components. I don&#8217;t need to worry about how a view component comes into being, I just set up a rule that ensures when that view components arrives I have a Mediator to link it back into the application. This is great for items inside Tab Navigators, Accordians, View Stacks etc.</p>
<p>It does present a little problem however: context. When you manually create and register a Mediator, you have the opportunity to give it some context, such as setting a property on it. Mediators that get automatically created make this a bit tricky. We could, of course, set that property on the view component, to be picked up by the Mediator on registration, but that&#8217;s not cool &#8211; view components should be self-contained, stand-alone widgets.</p>
<p>My current solution is to allow Mediators to request properties from parent Mediators. This is made possible by the Mediator Factory, with it&#8217;s dictionary of currently registered Mediators and view components, and a method declared by the Mediator Interface called &#8220;provideProperty&#8221;.</p>
<p>I plan on releasing Robot Legs once it has settled down a bit &#8211; using it in my current project has pointed out a great many things that I had overlooked initially. It won&#8217;t be everyone&#8217;s cup of tea &#8211; nothing is <img src='http://shaun.boyblack.co.za/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>UPDATE: RobotLegs 0.1, with demo Flex app, has been released.</strong> More info here:</p>
<p><a title="RobotLegs - an 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/">http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2009/03/13/as3-dependency-injection-and-autowire/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Pijin.net V3 Progress Update &#8211; 24 Feb 2009</title>
		<link>http://shaun.boyblack.co.za/blog/2009/02/24/pijinnet-v3-progress-update-24-feb-2009/</link>
		<comments>http://shaun.boyblack.co.za/blog/2009/02/24/pijinnet-v3-progress-update-24-feb-2009/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 15:56:35 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Pijin]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[mate]]></category>
		<category><![CDATA[milestones]]></category>
		<category><![CDATA[puremvc]]></category>
		<category><![CDATA[Robotlegs]]></category>
		<category><![CDATA[smartypants-ioc]]></category>
		<category><![CDATA[swiz]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=177</guid>
		<description><![CDATA[For the most part, Pijin development has been going pretty well. Maciek came down from London in December and we managed to come up with solutions for most of the tough conceptual challenges that were worrying us. By mid Jan I had nailed a decent chunk of core system functionality, including: Listing public Games Entering [...]]]></description>
			<content:encoded><![CDATA[<p>For the most part, <a title="Pijin.net" href="http://shaun.boyblack.co.za/blog/2008/09/11/pijinnet-v3-whats-taking-so-long-or-markers-on-the-road-to-pijin-v3/">Pijin</a> development has been going pretty well. <a title="Maciek Strychalski" href="http://maciek.boyblack.co.za/" target="_blank">Maciek</a> came down from London in December and we managed to come up with solutions for most of the tough conceptual challenges that were worrying us.<span id="more-177"></span></p>
<p>By mid Jan I had nailed a decent chunk of core system functionality, including:</p>
<ul>
<li>Listing public Games</li>
<li>Entering a Game</li>
<li>Pulling Game Submission Pairs</li>
<li>Rating Pairs</li>
<li>Submission Scoring</li>
<li>Viewing Submission Details</li>
<li>Viewing Fullsize Submissions</li>
<li>Logging In</li>
<li>Uploading Submissions</li>
<li>Customizing/Editing Submissions</li>
<li>Writing Comments on Submissions</li>
</ul>
<p><strong>And Then&#8230;</strong></p>
<p>About <a title="Flexible RIA Architecture: PureMVC and Mate" href="http://shaun.boyblack.co.za/blog/2009/02/08/flexible-ria-architecture-puremvc-and-mate/" target="_blank">two weeks ago I came to the painful realization</a> that the client-side architectural framework I was using was adding unnecessary complexity to the project and generally slowing me down. I started looking at other options but each had <a title="PureMVC Forum" href="http://forums.puremvc.org/index.php?topic=1000.0" target="_blank">drawbacks that I was not willing to put up with</a>.</p>
<p>In the end though, it was not really the <a title="Document Based" href="http://code.google.com/p/mate-examples/wiki/DocumentBased" target="_blank">Document-Based</a> nature of the project that was giving me hassles. I wanted a system that could automatically attach Mediators to view components as they appeared, without all the hassles of manual Mediator instantiation, naming, registration and removal.</p>
<p>So, against all &#8220;better&#8221; judgement, I borrowed ideas from <a title="PureMVC" href="http://puremvc.org/" target="_blank">PureMVC</a>, <a title="Mate Flex Framework" href="http://mate.asfusion.com/" target="_blank">Mate</a> and <a title="Swiz Flex Framework" href="http://code.google.com/p/swizframework/" target="_blank">Swiz</a>, and rolled-my-own. And it was fun!</p>
<p>Conceptually it&#8217;s very much like <a title="PureMVC Framework" href="http://puremvc.org/" target="_blank">PureMVC</a>, except:</p>
<ul>
<li>It uses Dependency Injection instead of the Service/Model Locator Pattern</li>
<li>It uses Flash Events instead of a custom Notification scheme</li>
<li>Mediators can be automatically created for view components</li>
</ul>
<p>There is actually very little to the framework: A Mediator Factory (for automatically creating Mediators when view components arrive on stage) and a Command Factory (for wiring Commands to Events) &#8211; <strong>everything else</strong> is taken care of by <a title="Dependency Injection" href="http://en.wikipedia.org/wiki/Dependency_injection" target="_blank">Dependency Injection</a>.</p>
<p>I&#8217;m using the <a title="SmartyPants IOC" href="http://code.google.com/p/smartypants-ioc/" target="_blank">SmartyPants IOC</a> library to handle injection. I sent a mail to the author of said library to explain my framework idea and the problem it is aiming to address. In his response he mentioned that my problem might be one commonly referred to as &#8220;<a title="How do I build two similar but slightly different trees of objects?" href="http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions" target="_blank">robot legs</a>&#8220;. Rad! While not entirely accurate, I dig that phrase, and hereby name my framework &#8220;RobotLegs&#8221;!</p>
<p>I&#8217;m in the process of migrating Pijin over to RobotLegs, and so far everything is going very smoothly. I&#8217;ll post a more detailed description of RobotLegs once I&#8217;ve spent a decent amount of time &#8220;eating&#8221; it.</p>
<p><strong>UPDATE: RobotLegs 0.1, with demo Flex app, has been released.</strong> More info here:</p>
<p><a title="RobotLegs - an 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/">http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2009/02/24/pijinnet-v3-progress-update-24-feb-2009/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
