<?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>Lab49 Blog &#187; Flex</title>
	<atom:link href="http://blog.lab49.com/archives/category/flex/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.lab49.com</link>
	<description>Technology and industry insights from Lab49.</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:27:24 +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>Flex and Maven with Flexmojos—Part 3: Journeyman</title>
		<link>http://blog.lab49.com/archives/5710</link>
		<comments>http://blog.lab49.com/archives/5710#comments</comments>
		<pubDate>Wed, 16 Nov 2011 11:48:27 +0000</pubDate>
		<dc:creator>Haidee Clarke</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[flexmojos]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/?p=5710</guid>
		<description><![CDATA[Lab49&#8242;s Justin Moses writes the final article in the three-part series on Flex, Maven, and Flexmojos. This article should provide all the tools you need to manage your entire enterprise project with Maven and Flexmojos here.]]></description>
			<content:encoded><![CDATA[<p>Lab49&#8242;s Justin Moses writes the final article in the three-part series on Flex, Maven, and Flexmojos. This article should provide all the tools you need to manage your entire enterprise project with Maven and Flexmojos <a href="http://www.adobe.com/devnet/flex/articles/flex-maven-flexmojos-pt3.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/5710/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe: Official Maven support is coming</title>
		<link>http://justinjmoses.wordpress.com/2011/10/11/adobe-official-maven-support-is-coming/</link>
		<comments>http://justinjmoses.wordpress.com/2011/10/11/adobe-official-maven-support-is-coming/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 19:05:21 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=575</guid>
		<description><![CDATA[I recently spent a lot of time at AdobeMAX hassling the Flashbuilder team on what the deal is with Flex and Maven, and we’ve finally been given the word: support is coming &#8211; we just don’t yet know what form it’s going to take. Step One: Hosting the framework artifacts The first step towards Maven [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=575&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently spent a lot of time at AdobeMAX hassling the Flashbuilder team on what the deal is with Flex and Maven, and we’ve finally been given the word: support is coming &#8211; we just don’t yet know what form it’s going to take.</p>
<p><strong>Step One: Hosting the framework artifacts</strong></p>
<p>The first step towards Maven support is for Adobe to start hosting their releases in a Maven-friendly way. They have admitted that this is on the cards for them, but steered away from specifics. They have two real options here &#8211; either they submit their artifacts to Maven Central or they set up and deploy to their own public Nexus. Many of us in the community would like to see the former before the latter. Having AS3/Flex/AIR projects build out of the box without requiring any external repository would be a great start (Maven Central is referenced in every execution via the super POM). Currently while the Flexmojos plugin now lives in Maven Central, we’re still reliant on the community (specifically @velobr) to deploy the latest JARs, SWCs and RSLs to Sonatype.</p>
<p>Nevertheless, if Adobe were to host a Flash artifact repository, it could become the central repository for the community to deploy their own open source libraries. This could include tools such as unit testing libraries (FlexUnit, ASUnit), mocking tools (Mockolate, Fluint), micro-architectures (Robotlegs, Parsley), utilities (as3corelib, AS3Signals, RxAS), etc. This would then be the go-to for all Flash developers new to Maven. And, we could finally answer the question plaguing all Maven/Flash newbies: <strong>Where are my dependencies???</strong></p>
<p><strong>Step Two: Either sponsor, fork or replace Flexmojos</strong></p>
<p>The next step is for Adobe to decide what to do with Flexmojos &#8211; the open source Maven plugin that compiles Flash artifacts. Because it’s open source, they don’t want to usurp the hard work of the community and completely take it over as-is. As I see it, they can either fork it in its current state, sponsor it with funding and their own development team, or start again from the ground up and target Spark and above. In its current state, Flexmojos 4 (4.0-RC2 is the latest) is well equipped to deal with the needs of Flash projects up to and including Flash Player 10.3 (albeit with some bugs). Going forward however, we have no assurance that Flex 4.6 or AIR 3 will be supported out of the box, and I have doubts that the community alone will keep the pace.</p>
<p>Moreover, many of us Flash/Maven advocates are in enterprise development and find it hard enough to convince our customers to rely on an open source initiative that isn’t maintained by Adobe, let alone officially supported or sponsored. If Adobe get behind a Maven plug-in and put their stamp on it, we’ll have a much easier time advocating it to our clients.</p>
<p><strong>Step Three: Integrate with Flashbuilder</strong></p>
<p>Last but not least, is Flashbuilder (FB) integration. The current situation is fairly dismal. Flexmojos 3.9 was the last to officially support the flexbuilder/flashbuilder goal &#8211; the process which generated the project structure in Eclipse from your POM (creating and configuring .project and .actionScriptProperties among others). It’s been removed from Flexmojos 4 and there is currently no robust way to keep FB abreast of the latest changes in your POM. You <em>can</em> run the old 3.9 goal for partial results in FB 4.5, but it’s more hassle than it’s worth. Keeping large teams in sync across a complex project is cumbersome at best (and don’t get me started on checking in .project files).</p>
<p>While m2eclipse &#8211; the Maven-Eclipse plugin &#8211; provides the functionality required to run Maven within Flashbuilder, it is not integrated with the Flexmojos plugin. Put simply, m2eclipse is a lot less powerful with Flashbuilder than it is with typical Java projects in Eclipse. Updated your POM with a different Flex SDK, added some dependencies or a new runtime module? Fine, just make sure to tell all the developers to update their workspaces manually &#8211; otherwise either switch to IntelliJ or wait for Flashbuilder 5 (we hope).</p>
<p><strong>Looking forward</strong></p>
<p>The first step in a long process has begun. Adobe are taking the plunge into Maven compatibility and it seems the Flashbuilder team are our best hope for the future of the union. We know support is coming, but how exactly it will pan out is still up for debate. Hopefully we’ll have an answer before the end of the year, but I won’t be holding my breath.</p>
<p><strong>The latest</strong></p>
<p>Want to keep abreast of the latest developments, here’s a list of people to follow:</p>
<ul>
<li>Adam Lehman, PM for Flashbuilder, Adobe <a href="http://twitter.com/adrocknaphobia">@adrocknaphobia</a></li>
<li>Andrew Shorten, GPM of Dev Tools, Adobe <a href="http://twitter.com/ashorten">@ashorten</a></li>
<li>Raghu Thricovil, one of the new PMs of Flex, Adobe <a href="http://twitter.com/rthricov">@rthricov</a></li>
<li>The Flexmojos plugin <a href="http://twitter.com/flexmojos">@flexmojos</a></li>
<li>Marvin Froeder, Flexmojos creator <a href="http://twitter.com/velobr">@velobr</a></li>
<li>Me <a href="http://twitter.com/justinjmoses">@justinjmoses</a></li>
</ul>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/575/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=575&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/10/11/adobe-official-maven-support-is-coming/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>Selective removeAll() addition to as3-signals</title>
		<link>http://justinjmoses.wordpress.com/2011/09/22/selective-removeall-addition-to-as3-signals/</link>
		<comments>http://justinjmoses.wordpress.com/2011/09/22/selective-removeall-addition-to-as3-signals/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 18:03:38 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=527</guid>
		<description><![CDATA[This post and code is related to my fork of as3-signals. The fork is from the latest version of as3-signals 0.9-BETA. Summary of additions ISlot.applyTo(value:*):void ISlot.doesApply(value:*):Boolean SlotList.filterNotAppliesTo(value:*):SlotList SlotList.findNotAppliesTo(value:*):SlotList Summary of modifications IOnceSignal.removeAll(appliesTo:* = null):void Details This backwards compatible addition to as3-signals chiefly allows the removal of all listeners for a given instance or class type. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=527&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post and code is related to <a href="https://github.com/justinjmoses/as3-signals">my fork of as3-signals</a>. The fork is from the latest version of as3-signals <em>0.9-BETA</em>.</p>
<p><strong>Summary of additions</strong></p>
<ul>
<li>ISlot.applyTo(value:*):void</li>
<li>ISlot.doesApply(value:*):Boolean</li>
<li>SlotList.filterNotAppliesTo(value:*):SlotList</li>
<li>SlotList.findNotAppliesTo(value:*):SlotList</li>
</ul>
<p><strong>Summary of modifications</strong></p>
<ul>
<li>IOnceSignal.removeAll(appliesTo:* = null):void</li>
</ul>
<p><strong>Details</strong></p>
<p>This backwards compatible addition to as3-signals chiefly allows the removal of all listeners for a given instance or class type. It keeps the convenience of the removeAll function but provides a mechanism to prevent removal of listeners not bound to the current instance or class.</p>
<p>The removeAll() method allows for an optional parameter which will then removeAll slots that applyTo the given parameter, if any.</p>
<p>Essentially, this allows us to asynchronously clean up after a class or instance without affecting any listeners from other classes and without having to define our anonymous functions or closures.</p>
<p><strong>Reasoning</strong></p>
<p>A signal &#8211; as a <a href="http://en.wikipedia.org/wiki/Futures_and_promises">promise</a> &#8211; may be reused across instances and classes. For example, a service that is managed by an IOC container may cache signal calls, or a model may use signals to notify of changes. When the signal is shared across various types (either directly via the IOC container, or indirectly cached within an instance) we don’t want to removeAll() lest we remove functional code in other classes (that may well have been written by other developers).</p>
<p><strong>Example</strong></p>
<p><em>Update Sept 23: Changed the example to use Robotlegs and Mediation</em></p>
<p>Let&#8217;s look at an example to follow this through. This example below illustrates usage when marshalling updates of a model to a view (using covariant mediation to an interface) via a Mediator. Chiefly, the problem arises when an asynchronous cleanup method is called (in this case `onRemove()`), it needs to remove all of the listeners applied to by this instance but not remove listeners that may be used elsewhere.</p>
<p>
<pre class="brush: as3;">
public class LogModel
{
	protected var updateSignal:ISignal;
	protected var logs:Vector.&lt;LogItem&gt;;

	public function get update():ISignal
	{
		return updateSignal ||= new Signal();
	}

	public function set logs(collection:Vector.&lt;LogItem&gt;):void
	{
		logs = collection;
		update.dispatch(logs);
	}
}

public class SomethingMediator extends Mediator
{
     [Inject]
     public var model:LogModel;

	 [Inject]
	 public var view:IDoesSomething;

     override public function onRegister():void
     {
        model.update.add(function(collection:Vector.&lt;LogItem&gt;):void
		{
			view.logs = collection;
		}).applyTo(this);
     }

     override public function onRemove():void
     {
          model.update.removeAll(this); //removes all listeners applied to this instance only
     }
}
</pre>
</p>
<p><strong>Usage (pseudo-code):</strong></p>
<p>
<pre class="brush: as3;">
//setup values
const logModel:LogModel = new LogModel();
injector.mapValue(LogModel, logModel);

//map interfaces to a mediator
mediatorMap.mapMediator(IDoesSomething, SomethingMediator);
const viewA:IDoesSomething = new DoesSomething();
const viewB:IDoesSomething = new DoesSomething();

//register mediators for our views (creates two instances of SomethingMediator)
mediatorMap.registerMediators(viewA);
mediatorMap.registerMediators(viewB);

trace(logModel.update.numListeners); //2 - one listener from viewA.onRegister() and one from viewB.onRegister()

mediatorMap.removeMediators(viewA);

trace(logModel.update.numListeners); //1 - one listener from viewB.onRegister()

mediatorMap.removeMediators(viewB);

trace(logModel.update.numListeners); //0
</pre>
</p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/527/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=527&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/09/22/selective-removeall-addition-to-as3-signals/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>Cleaning up after closures in Flash</title>
		<link>http://justinjmoses.wordpress.com/2011/08/19/cleaning-up-after-closures-in-flash/</link>
		<comments>http://justinjmoses.wordpress.com/2011/08/19/cleaning-up-after-closures-in-flash/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 14:45:52 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=468</guid>
		<description><![CDATA[If you haven’t experimented much with closures yet - whether in your Flash/Flex projects, Javascripting or while tinkering with Lua - it’s time to start. In case you’re a little nervous about those pesky memory leaks in Flash, here are some ways to cope.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=468&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you haven’t experimented much with closures yet &#8211; whether in your Flash/Flex projects, Javascripting or while tinkering with Lua &#8211; it’s time to start. In case you’re a little nervous about those pesky memory leaks in Flash, here are some ways to cope.</p>
<p><a href="http://www.flickr.com/photos/lrargerich/2787454868/" title="Pampas Fractal by lrargerich, on Flickr"><img src="http://farm4.static.flickr.com/3062/2787454868_eaa791afd0.jpg" width="500" height="250" alt="Pampas Fractal"></a></p>
<div style="border:1px dotted #ccc;background-color:#eee;padding:.5em;">
<div style="font-size:4em;color:white;float:left;">&raquo;&nbsp;</div>
<p> Much of the following code is bundled into an example Flex project that compares the various closure techniques around a custom Timer class.</p>
<p><a href="https://github.com/justinjmoses/closures-cleaning-example">Check the code on Github</a>.</p>
</div>
<h2 id="what_are_closures" style="font-size:1.3em;margin-top:1.5em;border-bottom:1px solid #AAA;">What are closures?</h2>
<p>Many people think of closures as anonymous functions &#8211; probably because that’s the common form they take &#8211; but they are more than that. They are scoped, inline functions that provide a “closure” over a collection of free variables (within the function scope).</p>
<p><a href="http://en.wikipedia.org/wiki/Closure_(computer_science)" >Check out the Wikipedia entry on closures.</a>.</p>
<h2 id="why_use_them" style="font-size:1.3em;margin-top:1.5em;border-bottom:1px solid #AAA;">Why use them?</h2>
<ul style="margin-top:1em;">
<li>They allow the hiding of state (negating the need for maintaining async state in the class) as each closure defines its own variable scope that are available to all nested closures; and</li>
<li>Because they’re easier to follow than continually jumping to functions defined at a type-level.</li>
</ul>
<h2 id="take_a_peek" style="font-size:1.3em;margin-top:1.5em;border-bottom:1px solid #AAA;">Take a peek</h2>
<p>In the below example, we have two closures &#8211; the first defines the <em>userEvent</em> property and <em>someVariable</em>, the second adds to that with it’s own scope of <em>serviceEvent</em>. You see how the inner closure has access not only to that state within itself, but also to that of the outer closure, as well as that of the <em>init()</em> function AND the class itself. Welcome to the scope chain. <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f54.html">Read the AS3 docs on Function Scope</a>.</p>
<p>
<pre class="brush: as3; highlight: [10,18]; toolbar: false;">
public class SomeClass
{
	protected var view:ISomeView;

	public function init():void
	{
		var functionSaysSo:Boolean = true;

		userAction.addEventListener(UserEvent.LOGIN,
			function(userEvent:UserEvent):void
			{
				//this is outer closure 

				//define a variable in the outer closure's scope
				var someVariable:String = &quot;something&quot;;

				service.addEventListener(ServiceEvent.RESULT,
					function(serviceEvent:ServiceEvent):void
					{
						//this is the inner closure

						if (functionSaysSo)
						{
							view.notify(userEvent.username, serviceEvent.result, someVariable);
						}
					});

				//async call
				service.start(userEvent.username, userEvent.pass);

			});
	}
}
</pre>
</p>
<blockquote><p><strong>Tip</strong>: If you find yourself contesting the readability assertion from before, don’t fret &#8211; it’s early days.</p>
</blockquote>
<h2 id="cleaning_up_after_yourself" style="font-size:1.3em;margin-top:1.5em;border-bottom:1px solid #AAA;">Cleaning up after yourself</h2>
<p>Like any listener, using a closure as an event listener can create memory leaks if not properly cleaned up. Luckily, we have a few options up our sleeves to avoid this.</p>
<h3 id="1_use_weak_references" style="font-size:1.1em;border-bottom:1px solid #CCC;">Use weak references? [Short answer: no]</h3>
<p>Clean, simple and easy, we could simply add closures as weak references.</p>
<p>
<pre class="brush: as3; highlight: [5]; toolbar: false;">
userAction.addEventListener(UserEvent.LOGIN,
	function():void
	{

	}, false, 0, true);
</pre>
</p>
<p><strong>This keeps the code trim, however it introduces its own problems</strong>. If the variable you are listening to lives (is scoped) within another closure or a function definition, it will get cleaned up after the function completes (and before the event might fire). Without a strong reference to that variable, it is a target for garbage collection and you will end up with unpredictable results.</p>
<p>For example, in the following, there is nothing holding onto the timer instance to ensure after the function ends (and before the timer completes) that the timer will still exist and dispatch the <em>TIMER_COMPLETE</em> event.</p>
<p>
<pre class="brush: as3; highlight: [7]; toolbar: false;">
public class SomethingWeak implements IDoesSomething
{
	public function doSomething():void
	{
		var timer:Timer = new Timer(1000,-1);

		//WARNING! Nothing is holding a reference to timer - GC candidate
		timer.addEventListener(TimerEvent.TIMER_COMPLETE,
			function(evt:TimerEvent):void
			{
				//something happened!
			}, false, 0, true); 

		timer.start();
	}
}
</pre>
</p>
<h3 id="2_name_your_handlers" style="font-size:1.1em;border-bottom:1px solid #DDD;">1. Name your handlers</h3>
<p>To improve on this, simply define your handlers locally, and you can remove them within your listeners:</p>
<p style="font-size:smaller;"><strong>&raquo; Aug 30: Updated to inline definition</strong></p>
<p>
<pre class="brush: as3; highlight: [9,14]; toolbar: false;">
public class SomethingNamed implements IDoesSomething
{
	public function doSomething():void
	{
		var timer:Timer = new Timer(1000,-1);

		var timerHandler:Function;

		timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerHandler = function(evt:TimerEvent):void
		{
			//something happened!

			//cleanup after ourselves
			timer.removeEventListener(TimerEvent.TIMER_COMPLETE, timerHandler);
		});

		timer.start();
	}
}
</pre>
</p>
<h3 id="3_use_argumentscallee_to_remove_them_during_execution" style="font-size:1.1em;border-bottom:1px solid #CCC;">2. Use arguments.callee to remove them during execution</h3>
<p>Even better, we can take advantage of a little known feature in AS3 called <em>arguments.callee</em>, and not even have to name our function:</p>
<p>
<pre class="brush: as3; highlight: [13]; toolbar: false;">
public class SomethingCallee implements IDoesSomething
{
	public function doSomething():void
	{
		var timer:Timer = new Timer(1000,-1);

		timer.addEventListener(TimerEvent.TIMER_COMPLETE,
			function(evt:TimerEvent):void
			{
				//something happened

				//cleanup after ourselves
				timer.removeEventListener(TimerEvent.TIMER_COMPLETE, arguments.callee);
			});

		timer.start();
	}
}
</pre>
</p>
<h3 id="4_use_type_level_handlers_to_remove_from_separate_call" style="font-size:1.1em;border-bottom:1px solid #CCC;">3. Use type-level handlers to remove from separate call</h3>
<p>Alas, what if you need to clean up based on another method or event later in the piece (say when a mediator is disposed)? You’ll need to define your handler at a type-level to retain a reference of it:</p>
<p style="font-size:smaller;"><strong>&raquo; Aug 30: Updated to inline definition</strong></p>
<p>
<pre class="brush: as3; highlight: [4,13]; toolbar: false;">
public class SomethingDisposable implements IDoesSomething, IDisposable
{
	//handler is now defined at a type (class) level
	private var timerHandler:Function;

	//we have to also scope the timer to the type level in order to remove listeners
	private var timer:Timer;

	public function doSomething():void
	{
		timer = new Timer(1000,-1);

		timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerHandler = function(evt:TimerEvent):void
		{
			//something happened!
		});

		timer.start();
	}

	public function dispose():void
	{
		if (!timer) return;

		timer.removeEventListener(TimerEvent.TIMER_COMPLETE, timerHandler);

		//for completeness sake
		timer.stop();
		timer = null;
	}
}
</pre>
</p>
<blockquote style="border:1px dotted #ccc;background-color:#eee;padding:.5em;"><p>At this point, you may be wondering why bother with a closure, when you could simply define the handler as a private method? In this particular example, there is no difference unless you wanted the handler to access the <em>timer</em> instance itself in the handler.</p>
</blockquote>
<h3 id="5_use_signals" style="font-size:1.1em;border-bottom:1px solid #CCC;">4. Use Signals</h3>
<p>There is a final alternative &#8211; use the <a href="http://justinjmoses.wordpress.com/2011/07/07/whats-the-deal-with-signals/">as3-signals</a> library. AS3 Signals is a library that provides an alternative to using Flash Events within your APIs. Using Signals, there are a handful of alternatives to clean up after your closures. Every signal implements ISignal, and it’s that interface we’ll focus on.</p>
<h4 id="isignaladdonce" style="font-size:1em;font-weight:bold;border-bottom:1px solid #EEE;">ISignal.addOnce()</h4>
<p><em>ISignal.addOnce()</em> prescribes attaching a handler which is called once when the signal dispatches and is removed immediately. Below we use a NativeSignal to wrap the <em>TimerEvent.TIMER_COMPLETE</em>, allowing us to avoid attaching and removing event listeners ourselves. We also now return a <em>Signal</em> which gives the user of the class a strongly-typed signal to what they expect.</p>
<p>
<pre class="brush: as3; highlight: [14]; toolbar: false;">
public class SomethingSignalsAddOnce implements IDoesSomethingWithSignals
{
	public function doSomething(index:int):ISignal
	{
		//create a Signal to return
		const response:ISignal = new Signal(int);

		const timer:Timer = new Timer(index * 100,-1);

		//create a signal from the Timer event
		const signal:NativeSignal = new NativeSignal(timer, TimerEvent.TIMER_COMPLETE, TimerEvent);

		//once TIMER COMPLETE has occurred, we can dispatch our signal - ISignal.addOnce() ensures that any listeners to Timer will be cleaned up
		signal.addOnce(function(evt:TimerEvent):void
		{
			//tell response that something happened (as opposed to dispatching an event, we dispatch the signal)
			response.dispatch(index);
		});

		timer.start();

		return response;
	}
}
</pre>
</p>
<p>This is often very useful, but not always optimal. We may not always want to listen only once &#8211; say if we need to selectively remove the listener based on certain conditions. Sometimes we may only want to remove the listener based on another asynchronous event (as in #4 above).</p>
<h4 id="isignalcallee" style="font-size:1em;font-weight:bold;border-bottom:1px solid #EEE;">Signals and arguments.callee</h4>
<p>Alternatively, we could use the <em>arguments.callee</em> property and do a conditional remove when required (after 5 ticks in the below example):</p>
<p>
<pre class="brush: as3; highlight: [21]; toolbar: false;">
public class SomethingSignalsCallee implements IDoesSomethingWithSignals
{

	public function doSomething(index:int):ISignal
	{
		//create a Signal to return
		const response:ISignal = new Signal(int);

		const timer:Timer = new Timer(100);

		//create a signal from the Timer event
		const signal:NativeSignal = new NativeSignal(timer, TimerEvent.TIMER, TimerEvent);

		var numTicks:int = 0;

		signal.add(function(evt:TimerEvent):void
		{
			if (numTicks++ == 5)
			{
				response.dispatch(index);
				signal.remove(arguments.callee);
				timer.stop();
			}
		});

		timer.start();

		return response;
	}
}
</pre>
</p>
<blockquote style="border:1px dotted #ccc;background-color:#eee;padding:.5em;"><p>You might wonder if you can use <em>arguments.callee</em> within nested closures &#8211; and the answer is yes. Just be aware that each closure has its own definition of the <em>arguments.callee</em>, and it overrides the value from any outer closures.</p>
</blockquote>
<h4 id="isignalremoveall" style="font-size:1em;font-weight:bold;border-bottom:1px solid #EEE;">ISignal.removeAll()</h4>
<p><em>ISignal</em> also expose the convenience method: <em>removeAll()</em>. This can help us when we need to remove listeners in response to another method call.</p>
<p>
<pre class="brush: as3; highlight: [16,29]; toolbar: false;">
public class SomethingSignalsRemoveAll implements IDoesSomethingWithSignals, IDisposable
{
	private var timerSignal:ISignal;
	private var timer:Timer;

	public function doSomething(index:int):ISignal
	{
		//create a Signal to return
		const response:ISignal = new Signal(int);

		timer = new Timer(500);

		//create a signal from the Timer event
		timerSignal = new NativeSignal(timer, TimerEvent.TIMER, TimerEvent);

		timerSignal.add(function():void
		{
			response.dispatch(index);
		});

		timer.start();

		return response;
	}

	public function dispose():void
	{
		timer.stop();
		timerSignal.removeAll();
	}
}
</pre>
</p>
<blockquote style="border:1px dotted #ccc;background-color:#eee;padding:.5em;"><p>Be careful using <em>removeAll()</em> &#8211; if your class aggregates the signal as above, and it never leaves the containing type, fine. However, there may be occasions when you pass a signal around between various classes (as we do with the <em>response</em> signal above). In these classes, using <em>removeAll()</em> could present unwanted results if one developer inadvertently removes listeners that another class attached.</p>
</blockquote>
<h2 id="conclusions" style="font-size:1.3em;border-top:1px solid #CCC;margin-top:1.1em;">Conclusions</h2>
<p>Whichever way you use closures, you need to remember to clean up after yourself, less you end up leaking memory in the Flash player. Asynchronous programming is here to stay (take node.js and Reactive eXtensions for .NET as examples) and we’re lucky that Actionscript &#8211; built on ECMA &#8211; supports it natively. As long as you’re aware of the consequences of attaching inline handlers, you can use closures and the async model in general to design a different approach to solving common asynchronous problems. While it takes a little getting used to, I wholeheartedly recommend giving it a shot &#8211; you might just like it.</p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/468/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=468&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/08/19/cleaning-up-after-closures-in-flash/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>UI mediation sucks. Mediate behaviours, not views.</title>
		<link>http://justinjmoses.wordpress.com/2011/08/07/ui-mediation-sucks-mediate-behaviours-not-views/</link>
		<comments>http://justinjmoses.wordpress.com/2011/08/07/ui-mediation-sucks-mediate-behaviours-not-views/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 16:05:39 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=415</guid>
		<description><![CDATA[Code for this post can be found on Github. In this post, we’re going to look at how the variance utility for Robotlegs allows mediation against interfaces rather than concrete classes. Apart from the gains in decoupling, we can mediate purely against behaviours, rather than specific implementation. And, as we’re talking interfaces, a UI component [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=415&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="background-color:#eee;border:1px dashed #AAA;padding:.5em;">Code for this post can be found on <a title="Github" href="https://github.com/justinjmoses/mediate-behaviours-example" >Github</a>.</p>
<p>In this post, we’re going to look at how the variance utility for Robotlegs allows mediation against interfaces rather than concrete classes. Apart from the gains in decoupling, we can mediate purely against behaviours, rather than specific implementation. And, as we’re talking interfaces, a UI component can implement as many interfaces (behaviours) as it likes!</p>
<ul>
<li>Shout out to <a href="http://twitter.com/guyinthechair">Paul Taylor</a> for the <a href="http://guyinthechair.com/2011/07/design-by-contract-in-robotlegs-1-4/">inspiration of this post</a>.</li>
</ul>
<p>Libraries used in this post:</p>
<ul>
<li><a href="https://github.com/robotlegs/robotlegs-framework/">Robotlegs v1.5.2</a></li>
<li><a href="https://github.com/dnalot/robotlegs-utilities-variance">Robotlegs Variance Utility v1.1</a></li>
<li><a href="https://github.com/robertpenner/as3-signals">As3-Signals v0.9-BETA</a></li>
</ul>
<p style="font-size:larger;font-weight:bold;"><strong>Why use mediation at all?</strong></p>
<p>Mediation is a design pattern that performs the job of managing communication between parts to decouple logic. In terms of modern MVC frameworks, mediators are typically employed to monitor UI pieces from the outside in, so that the UI has no references to the framework whatsoever. The common alternative is the Presentation Model pattern (PM) that typically involves injecting in one or more presentation models to the UI component. As such, the UI component is thus coupled to the particular PMs it uses. That said, when mediating against classes (rather than interfaces, which we’ll get to), we couple the mediator to the UI, which is suboptimal.</p>
<p style="font-size:larger;font-weight:bold;"><strong>Why Robotlegs?</strong></p>
<p>Robotlegs (RL) is a lightweight (50KB) and prescriptive library for MVCS applications. Out of the box it provides us with Mediation, IOC container and Dependency Injection via the familiar [Inject] metadata (thanks to SwiftSuspenders).</p>
<p style="font-size:larger;font-weight:bold;"><strong>Regular (invariant) mediation</strong></p>
<p>Take some UI component: (<strong>SomeComponent.mxml</strong>)</p>
<p>
<pre class="brush: as3;">
&lt;s:VGroup&gt;
    &lt;fx:Script&gt;
        //the mediator will tell me when something happens
        public function asyncReturned():void
        {
            //something happened!
        }

        private function onClick(evt:MouseEvent):void
        {
            //tell whoever's listening to do something
            dispatchEvent(new ControlEvent(ControlEvent.START));
        }
    &lt;/fx:Script&gt;

    &lt;s:Button label=&quot;Start&quot; click=&quot;onClick(event)&quot; /&gt;
&lt;/s:VGroup&gt;
</pre>
</p>
<p>A mediator for this component might look like (<strong>SomeComponentMediator.as</strong>):</p>
<p>
<pre class="brush: as3;">
public class SomeComponentMediator extends Mediator
{
    [Inject]
    public var view:SomeComponent;

    [Inject]
    public var service:ISomeService;

    private var viewHandler:Function;
    private var serviceHandler:Function;

    //called when UI component is added to stage and mediator assigned
    override public function onRegister():void
    {
        //handle control events responding
        viewHandler = function(evt:ControlEvent):void
        {
            serviceHandler = function(evt:ServiceEvent):void
            {
                //some where later on tell the view it is done...
                view.asyncReturned();
            }
            service.addEventListener(ServiceEvent.COMPLETE, serviceHandler);

            service.doSomething();
        }

        //attach the listener
        view.addEventListener(ControlEvent.DO_ASYNC, viewHandler);
    }

    //called when UI component is removed from stage, prior to mediator being destroyed
    override public function onRemove():void
    {
       service.removeEventListener(ServiceEvent.COMPLETE, serviceHandler);
       view.removeEventListener(ControlEvent.DO_ASYNC, viewHandler);
    }
}
</pre>
</p>
<p>Via the ADDED_TO_STAGE event, Robotlegs wires up an instance of a mediator for each UI component it finds. All that it requires is that you map in the mediator:</p>
<p>
<pre class="brush: as3;">
IMediatorMap.mapMediator(SomeComponent, SomeComponentMediator);
</pre>
</p>
<blockquote style="background-color:#eee;border:1px dashed #AAAAAA;padding:1em;"><p>Don’t like extending base classes or want your own implementation of mediation? No problems just implement IMediator instead.</p>
</blockquote>
<p style="font-size:larger;font-weight:bold;"><strong>So why covariance?</strong></p>
<p>Because there are some problems here with mediating directly to views:</p>
<ul>
<li>A UI component can only have one mediator;</li>
<li>The mediator is tightly coupled to the UI control.</li>
</ul>
<p>So, what if we wanted to map to an interface instead? We could include the Robotlegs Variance Utility (as a library to our project), and tweak our mediator mapping call to:</p>
<p>
<pre class="brush: as3;">
IVariantMediatorMap.mapMediator(ISomeComponent, SomeComponentMediator);
</pre>
</p>
<p>The above example becomes:</p>
<p>
<pre class="brush: as3;">
&lt;s:VGroup implements=&quot;ISomeBehaviour&quot;&gt;
	&lt;fx:Script&gt;
		//the mediator will tell me when async returns
		public function asyncReturned():void
		{
			//something happened!
		}

		private function onClick(evt:MouseEvent):void
		{
		     //tell whoever's listening to do something
		     dispatchEvent(new ControlEvent(ControlEvent.START));
		}
        &lt;/fx:Script&gt;

    &lt;s:Button label=&quot;Start&quot; click=&quot;onClick(event)&quot; /&gt;
&lt;/s:VGroup&gt;
</pre>
</p>
<p>Using this interface:</p>
<p>
<pre class="brush: as3;">
[Event(name=&quot;startAsync&quot;,type=&quot;ControlEvent&quot;)]
public interface ISomeBehaviour
{
	function asyncReturned();
}
</pre>
</p>
<p>And the mediator becomes:</p>
<p>
<pre class="brush: as3;">
public class SomeComponentMediator extends Mediator
{
    [Inject]
    public var view:ISomeBehaviour;

    //... (as before)

}
</pre>
</p>
<p>And voila &#8211; we’ve solved both problems in one fell swoop! A UI control can implement as many interfaces as it needs, and our mediates now mediate against a behaviour rather than a concrete UI piece.</p>
<p style="font-size:larger;font-weight:bold;"><strong>So now what?</strong></p>
<p>There’s still room for improvement. Flash has no way to enforce that the class &#8211; SomeComponent &#8211; will actually dispatch the ControlEvent. If we’re writing these interfaces &#8211; these behaviours &#8211; we want a contract that explicitly states which events should be fired. Better yet, we’d like the option to state if these events are a functional level or a type level.</p>
<p style="font-size:larger;font-weight:bold;"><strong>Enter Signals, stage right</strong></p>
<p>Signals provide an alternative to events. They are designed to be used within APIs and class libraries, rather than replacing events altogether (Flash events are well suited to UI hierarchies). Where events fire and are handled at a type (class) level, signals live at the variable level. Not only can we pass them to and return them from methods, we can also enforce their presence in types that implement our interfaces. Check out an earlier post on <a href="http://justinjmoses.wordpress.com/2011/07/07/whats-the-deal-with-signals/">Signals</a>.</p>
<p>By including the lightweight Signals SWC, we have access to the ISignal contract and some common implementations.</p>
<p>Our interface from before now becomes:</p>
<p>
<pre class="brush: as3;">
public interface ISomeBehaviour
{
    function asyncReturned();

    function get start():ISignal;
}
</pre>
</p>
<p>Our view becomes:</p>
<p>
<pre class="brush: as3;">
&lt;s:VGroup implements=&quot;ISomeBehaviour&quot;&gt;
    &lt;fx:Declarations&gt;
        &lt;signals:Signal id=&quot;startSignal&quot; /&gt;
    &lt;/fx:Declarations&gt;

    &lt;fx:Script&gt;
        //the mediator will tell me when something happens
        public function asyncReturned():void
        {
            //something happened!
        }

        //provide access to the type-level signal
        public function get start():ISignal
        {
            return startSignal;
        }
    &lt;/fx:Script&gt;

    &lt;!-- Here we actually send the message to the mediator --&gt;
    &lt;s:Button label=&quot;Start&quot; click=&quot;start.dispatch()&quot; /&gt;
&lt;/s:VGroup&gt;
</pre>
</p>
<p>We actually now have a property <em>start</em>, exposed from the view that implements the interface, that we can attach and remove handlers to in our mediator.</p>
<p>And so our mediator finally becomes:</p>
<p>
<pre class="brush: as3;">
public class SomeComponentMediator extends Mediator
{
    [Inject]
    public var view:ISomeComponent;

    [Inject]
    public var service:ISomeService;

    private var serviceSignal:ISignal;

    override public function onRegister():void
    {
        //handle control events responding
        view.start.add(function():void
        {
            serviceSignal = service.doSomething();

            serviceSignal.add(function():void
            {
                //when the service returns, notify the view
                view.asyncReturned();
            });
        });
    }

    override public function onRemove():void
    {
        serviceSignal.removeAll();
        view.start.removeAll(); //clean up any listeners
    }
}
</pre>
</p>
<p style="font-size:larger;font-weight:bold;"><strong>So what now?</strong></p>
<p>Grab the code on <a title="Github" href="https://github.com/justinjmoses/mediate-behaviours-example" >Github</a> and have a play around. For ease of use, I’ve included the dependencies along with the source.</p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/415/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=415&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/08/07/ui-mediation-sucks-mediate-behaviours-not-views/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>An introduction to Maven and Flexmojos</title>
		<link>http://justinjmoses.wordpress.com/2011/07/27/an-introduction-to-maven-and-flexmojos/</link>
		<comments>http://justinjmoses.wordpress.com/2011/07/27/an-introduction-to-maven-and-flexmojos/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 14:49:20 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=385</guid>
		<description><![CDATA[I presented an introduction to Maven and Flexmojos last night. The talk is a varient of the one I will be giving at FITC@MAX this year. The talk starts off discussing Maven, the hierarchical structure of projects, POMs and the build life cycle. We then discuss the Flexmojos plugin to build Flex applications. After that, we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=385&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I presented an introduction to Maven and Flexmojos last night. The talk is a varient of the one I will be giving at <a title="FITC@MAX" href="http://www.fitc.ca/events/about/?event=122" ><strong>FITC@MAX</strong> </a>this year.</p>
<p>The talk starts off discussing Maven, the hierarchical structure of projects, POMs and the build life cycle. We then discuss the Flexmojos plugin to build Flex applications. After that, we talk about repositories &#8211; both local and remote, and discuss how Nexus can perform the role of remote repository within your organisation, proxying to others on the web.</p>
<p>We work through 6 main examples. All code is on <a title="Github" href="https://github.com/justinjmoses/flexmojos-introduction" >Github</a>.</p>
<ol>
<li>The simplest application possible &#8211; a custom Hello World that uses the latest Flexmojos (4.0-RC1) and Flex SDK (4.5.1)</li>
<li>Adding automated unit tests to the build</li>
<li>Installing custom dependencies that aren&#8217;t hosted on the web</li>
<li>Using the Flasbuilder goal to create a Flashbuilder project from a build script</li>
<li>Starting Flex applications from the supported archetypes (templates)</li>
<li>A basic application that has custom dependencies and its own class library.</li>
</ol>
<div id="__ss_8697845" style="width:510px;"><iframe src='http://www.slideshare.net/slideshow/embed_code/8697845' width='510' height='418' scrolling='no'></iframe></div>
<p>Source files: <a title="Source" href="https://github.com/justinjmoses/flexmojos-introduction" >https://github.com/justinjmoses/flexmojos-introduction</a></p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/385/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=385&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/07/27/an-introduction-to-maven-and-flexmojos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What’s the deal with Signals?</title>
		<link>http://justinjmoses.wordpress.com/2011/07/07/whats-the-deal-with-signals/</link>
		<comments>http://justinjmoses.wordpress.com/2011/07/07/whats-the-deal-with-signals/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 03:06:45 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=302</guid>
		<description><![CDATA[Signals. Heard of them? What's the big deal you say?

Simple. The event system in AS3 is both limited and antiquated. True, native AS3 events offer a convenient way of messaging (bubbling) withinUI hierarchies. Yet, at an abstract API level, they more often as not restrict the developer than aid them.

Chiefly, what Robert Penner has done with <strong>as3-signals</strong> is create a way to represent events as variables, rather than as magical strings firing off at the type (class) level. It sounds simple. It is. Yet the implications for your architecture is vast.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=302&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="Signals Home" href="https://github.com/robertpenner/as3-signals" >Signals</a>. Heard of them? What&#8217;s the big deal you say?</p>
<p>Simple. The event system in AS3 is both limited and antiquated. True, native AS3 events offer a convenient way of messaging (bubbling) withinUI hierarchies. Yet, at an abstract API level, they more often as not restrict the developer than aid them.</p>
<p>Chiefly, what Robert Penner has done with <strong>as3-signals</strong> is create a way to represent events as variables, rather than as magical strings firing off at the type (class) level. It sounds simple. It is. Yet the implications for your architecture is vast.</p>
<p>Consider the following interface of asynchronous methods:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
public interface IServiceStream
{
  function open():void;
  function close():void;
}</pre>
</p>
<p>Now, as the contract is asynchronous, we&#8217;ll need some events to notify us when methods have completed. Let&#8217;s say we have the following events:</p>
<ul>
<li>OPENED</li>
<li>CLOSED</li>
<li>ERROR</li>
<li>TIMEOUT</li>
</ul>
<p>In keeping with the native AS3 model, the best we can hope for is using the following metadata at the type level:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
[Event(name=&quot;streamOpened&quot;,type=&quot;...&quot;)]
[Event(name=&quot;streamClosed&quot;,type=&quot;...&quot;)]
[Event(name=&quot;streamError&quot;,type=&quot;...&quot;)]
[Event(name=&quot;streamTimeout&quot;,type=&quot;...&quot;)]
public interface IServiceStream
{
 //...
}
</pre>
</p>
<p>There are four problems with this approach:</p>
<ol>
<li>Decorating via metadata does not enforce that implementors of the interface actually dispatch these events.</li>
<li>We should, for completeness, define the events somewhere as static constants. This means we can no longer simply write interfaces, and need to write event implementations and deploy them with our API;</li>
<li>We&#8217;re using magic strings, and as there is no compile-time checking of the metadata, we&#8217;re opening ourselves up to illusive runtime errors, if the wrong events are dispatched.</li>
<li>There is nothing to specify which events fire when &#8211; and which events belong to which method, and which belong to the class itself.</li>
</ol>
<div>The first two are fairly straightforward, so let&#8217;s focus on the latter two.</div>
<p style="font-size:larger;"><strong>Magic Strings and No Contract</strong></p>
<div>We have no way of tying the event type to the constant in some Event class it will eventually correspond to. &#8220;streamOpened&#8221; may map to ServiceStreamEvent.OPENED, and yet we cannot know this at the metadata level (not for the interface or even the implementor). From #1, it is evident that although we can put these requirements in, we cannot enforce their usage.</div>
<p style="font-size:larger;"><strong>Method vs Type-level Events </strong></p>
<div>Anyone listening to an implementor of our interface, would listen at the type level for all events, and deal with them as they occurred.</div>
<p>For example:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
var service:IServiceStream = new ServiceStreamImplementation(...);

service.addEventListener(ServiceStreamEvent.OPENED, function(evt:Event):void { ... } );
service.addEventListener(ServiceStreamEvent.CLOSED, function(evt:Event):void { ... } );
service.addEventListener(ServiceStreamEvent.ERROR, function(evt:Event):void { ... } );
service.addEventListener(ServiceStreamEvent.TIMEOUT, function(evt:Event):void { ... } );

//later when required
service.open();
</pre>
</p>
<div>We&#8217;ve been forced to declare all our handlers in one point, early enough to precede the calling of any event-dispatching methods. Anyone reading the code will have no real knowledge at which point the implementing class dispatches which event &#8211; hence why all the listeners need to be adding initially. As the interface writer, all we can do is say &#8220;this interface can dispatch any of these events&#8221; &#8211; we cannot even enforce that they are used. From #1 above, the metadata is not enforced, it&#8217;s just decoration.</div>
<p>Here is where Signals come in. Let&#8217;s rewrite the interface using simple signals.</p>
<div>
<pre class="brush: as3; wrap-lines: false;">
public interface IServiceStream
{
  function open():ISignal;
  function close():ISignal;
}</pre>
</p>
</div>
<div>Now let&#8217;s look at a partial implementation.</div>
<div>
<pre class="brush: as3; wrap-lines: false;">
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;

import org.osflash.signals.ISignal;
import org.osflash.signals.Signal;

public class ServiceStream implements IServiceStream
{
	public function open():ISignal
	{
		var signal:Signal = new Signal(Object);

		//do something asynchronously...
		var httpService:HTTPService = new HTTPService();
		httpService.addEventListener(ResultEvent.RESULT,
			function(evt:ResultEvent):void
			{
				//use the closure to access your signal and dispatch it async
				signal.dispatch(evt.result);
			});

		httpService.send();

		return signal;
	}

	//function close();
}
</pre>
</p>
</div>
<p>Now, the usage of this implementation can become:</p>
<div>
<pre class="brush: as3; wrap-lines: false;">
var service:IServiceStream = new ServiceStreamImplementation(...);

service.open().addOnce(function(result:Object):void
{
    //do something with your returned &quot;result&quot;
});
</pre>
</p>
</div>
<p><strong>In one fell swoop we fixed all four of the problems with events.</strong> We even have the convenience methods <em>addOnce()</em> and <em>removeAll()</em> from the ISignal interface. The former ensures your listener is removed after it is first used, the latter is pretty self-explanatory. If you look even closer, you&#8217;ll see we just implemented the <a title="Fluent Interface" href="http://en.wikipedia.org/wiki/Fluent_interface" >Fluent interface</a> for free.</p>
<p style="line-height:1.2;background-color:#eeeeee;border:1px solid #CCCCCC;padding:5px;">Imagine this in your mediator pattern &#8211; your UIs by definition have no reference to their mediator. Now they have a prescribed way of notifying their mediators that something has occurred.</p>
<p style="font-size:larger;"><strong>Wait a second. What about those other events?</strong></p>
<p>How do you return multiple items from a regular method call &#8211; compose a type for your requirements.</p>
<p>You could write the following signal collection:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
public class ServiceSignals
{
	public var open:ISignal = new Signal(Object);
	public var error:ISignal = new Signal(String);
	public var timeout:ISignal = new Signal();
}
</pre>
</p>
<p>and change your interface to:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
public interface IServiceStream
{
  function open():ServiceSignals;
  //...
}
</pre>
</p>
<p>Better yet, you could keep your interface and simply conform your Signal collection into an ISignal with a default listener/dispatcher:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
public class ServiceSignal extends Signal
{
	var open:ISignal = new Signal(Object);
	var error:ISignal = new Signal(String);
	var timeout:ISignal = new Signal();

	override public function add(listener:Function):ISignalBinding
	{
		return open.add(listener);
	}

	override public function addOnce(listener:Function):ISignalBinding
	{
		return open.addOnce(listener);
	}

	override public function dispatch(...parameters):void
	{
		open.dispatch();
	}

	override public function remove(listener:Function):ISignalBinding
	{
		return open.remove(listener);
	}

	override public function removeAll():void
	{
		open.removeAll();
	}
}
</pre>
</p>
<p>Then you could use it as such:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
var service:IServiceStream = new ServiceStreamImplementation(...);

var signal:ServiceSignal = service.open();

signal.addOnce(function(result:Object):void
{
    //do something with your returned &quot;result&quot;
});

signal.error.addOnce(...);

signal.timeout.addOnce(...);
</pre>
</p>
<p>Perhaps you&#8217;re not a huge fan of this solution. You may find that the error &amp; timeout signals are type-level events, and you don&#8217;t want to have to add handlers for both open() and close(). OK &#8211; so what about this implementation?</p>
<p>
<pre class="brush: as3; highlight: [30]; wrap-lines: false;">
public class ServiceStream implements IServiceStream
{
	public var error:ISignal = new Signal(String);
	public var timeout:ISignal = new Signal();

	private var _time:int = 30000;
	private var timer:Timer;

	public function open():ISignal
	{
		var signal:Signal = new Signal(Object);

		//do something asynchronously...
		var httpService:HTTPService = new HTTPService();
		httpService.addEventListener(ResultEvent.RESULT,
			function(evt:ResultEvent):void
			{
				//use the closure to access your signal and dispatch it async
				signal.dispatch(evt.result);
			});

		httpService.addEventListener(FaultEvent.FAULT,
			function(evt:FaultEvent):void
			{
				error.dispatch(evt.fault.faultString);
			});

		timer = new Timer(_time,1);

		var timerHandler:Function = function(evt:TimerEvent):void
			{
				timeout.dispatch();
				timer.removeEventListener(TimerEvent.TIMER_COMPLETE, timerHandler);
			}
		timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerHandler);

		httpService.send();

		timer.start();

		return signal;
	}

	//function close();

}
</pre>
</p>
<p style="line-height:1.2;background-color:#eeeeee;border:1px solid #CCCCCC;padding:5px;">Notice how we define the handler function as a variable so we can remove it in the listener. This is replicating the ISignal.addOnce() functionality. True, we could have used weak event listeners to allow for garbage collection, however this way is closer to our approach with Signals, so we&#8217;ll keep it for consistency.</p>
<p>Your implementor could then be used like this:</p>
<p>
<pre class="brush: as3; wrap-lines: false;">
var service:IServiceStream = new ServiceStreamImplementation(...);

service.open().addOnce(function(result:Object):void
{
    //do something with your returned &quot;result&quot;
});

service.error.addOnce(function(message:String):void
{
    //handle error
});

service.timeout.addOnce(function():void
{
    //handle timeout
});

service.close().addOnce(function():void
{
    //now closed
});
</pre>
</p>
<p>Whichever way you decide, Signals give you the choice you need to make the best decision for your API.</p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=302&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/07/07/whats-the-deal-with-signals/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>Flex code injection using conditional breakpoints</title>
		<link>http://justinjmoses.wordpress.com/2011/01/20/flex-code-injection-using-conditional-breakpoints/</link>
		<comments>http://justinjmoses.wordpress.com/2011/01/20/flex-code-injection-using-conditional-breakpoints/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 18:09:03 +0000</pubDate>
		<dc:creator>Justin Moses</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lab49]]></category>

		<guid isPermaLink="false">http://justinjmoses.wordpress.com/?p=275</guid>
		<description><![CDATA[So it's nothing new to many people, but something I saw in a video from MAX 2009 on Flash Builder 4 last year really stuck with me. And, it's been saving me day after day on this massive project.

It has to do with conditional breakpoints in FB4. On top of the normal, if x == true conditions, you can use a sneaky comma trick to inject code. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&#38;blog=2539888&#38;post=275&#38;subd=justinjmoses&#38;ref=&#38;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So while it&#8217;s not new news, something I saw in a <a href="http://2009.max.adobe.com/online/session/360" >video from MAX 2009</a> on Flash Builder 4 last year really stuck with me. And, it&#8217;s been saving me day after day on this massive project.</p>
<p>It has to do with <a title="Adobe Documentation on Conditional Breakpoints" href="http://help.adobe.com/en_US/flashbuilder/using/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7f07.html#WS31818EC7-B468-415b-9313-86456501967B" >conditional breakpoints in FB4</a>. On top of the normal, if x == true conditions, you can use a sneaky comma trick to inject code.</p>
<p>It&#8217;s simple, you enter true (1) or false (0) in the box (depending on whether you want the breakpoint to pause execution) and then add any expression(s) you want, separated by commas. The beauty is that these expression(s) is/are evaluated regardless of whether the breakpoint is executed or not. That means you can inject code into a running debug session without stopping to compile and rerun.</p>
<p>There are two main usages I&#8217;ve found for this feature:</p>
<p><strong>Inserting Traces</strong></p>
<p>I regularly find myself tracing through asynchronous operations, trying to figure out the order of events and properties at the time. Sometimes (and this evokes one very painful memory) I&#8217;m tracking multiple timers and I can&#8217;t learn anything from breakpoints, as I need to get an idea of the order of the ticks (and the corresponding events that are firing).</p>
<p>These scenarios make them a perfect candidate for the injected trace. Try this:</p>
<p style="text-align:center;">&nbsp;</p>
<div id="attachment_281" class="wp-caption aligncenter" style="width: 502px"><img class="size-full wp-image-281" title="FB4 Conditional Breakpoint Dialog: Tracing" src="http://justinjmoses.files.wordpress.com/2011/01/screengrab-flexbreakpoints-trace1.jpg?w=510" alt="FB4 Conditional Breakpoint Dialog: Tracing"   />
<p class="wp-caption-text">FB4 Conditional Breakpoint Dialog: Tracing</p>
</div>
<p style="text-align:center;">&nbsp;</p>
<p><strong>Modifying Properties</strong></p>
<p>The other main use-case is the all-too-common scenario when you want to change a property mid-execution. We&#8217;ve all been there &#8211; myself just today.</p>
<p style="text-align:center;">
<div id="attachment_284" class="wp-caption aligncenter" style="width: 503px"><img class="size-full wp-image-284 " title="FB4 Conditional Breakpoint Dialog: Property Setting" src="http://justinjmoses.files.wordpress.com/2011/01/screengrab-flexbreakpoints-propsetter.jpg?w=510" alt="FB4 Conditional Breakpoint Dialog: Property Setting"   />
<p class="wp-caption-text">FB4 Conditional Breakpoint Dialog: Property Setting</p>
</div>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justinjmoses.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justinjmoses.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justinjmoses.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justinjmoses.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justinjmoses.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justinjmoses.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justinjmoses.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justinjmoses.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justinjmoses.wordpress.com&amp;blog=2539888&amp;post=275&amp;subd=justinjmoses&amp;ref=&amp;feed=1" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://justinjmoses.wordpress.com/2011/01/20/flex-code-injection-using-conditional-breakpoints/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>Behavior driven development with FlexUnit and mockito</title>
		<link>http://blog.lab49.com/archives/4503</link>
		<comments>http://blog.lab49.com/archives/4503#comments</comments>
		<pubDate>Tue, 25 May 2010 16:47:15 +0000</pubDate>
		<dc:creator>Thorsten Lorenz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/?p=4503</guid>
		<description><![CDATA[Coming from a .Net background with strong emphasis  on best practices, one of my first missions when learning Flex, was to figure out how I could implement Behavior Driven Development  in this environment.

I tried a lot of different approaches ...]]></description>
			<content:encoded><![CDATA[<p>Coming from a .Net background with strong emphasis on best practices, one of my first missions when learning Flex, was to figure out how I could implement Behavior Driven Development  in this environment.</p>
<p>I tried a lot of different approaches and will show three of them.</p>
<p>I also discuss how to use mockito to supply us with mocks in a way that doesn&#8217;t interfere with the BDD approach.</p>
<p><a href="http://thorstenlorenz.wordpress.com/2010/05/23/bdd-with-flexunit-and-mockito-introduction/">You can read it here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/4503/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexUnit4 &amp; Parsley</title>
		<link>http://blog.lab49.com/archives/4450</link>
		<comments>http://blog.lab49.com/archives/4450#comments</comments>
		<pubDate>Mon, 10 May 2010 22:01:47 +0000</pubDate>
		<dc:creator>Anthony McCormick</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[DI]]></category>
		<category><![CDATA[FlashBuilder]]></category>
		<category><![CDATA[FlexUnit4]]></category>
		<category><![CDATA[Inversion Of Control]]></category>
		<category><![CDATA[IOC]]></category>
		<category><![CDATA[Parsley]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Test Driven Development]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/?p=4450</guid>
		<description><![CDATA[For the last six months I have been working on a rather large enterprise application that uses parsley as it&#8217;s main Dependency Injection Framework. This has led to many complex class&#8217; that contain multiple injected models, VO and other elements. Recreating these items inside test harness can become very cumbersome if you have to create [...]]]></description>
			<content:encoded><![CDATA[<p>For the last six months I have been working on a rather large enterprise application that uses parsley as it&#8217;s main Dependency Injection Framework. This has led to many complex class&#8217; that contain multiple injected models, VO and other elements. Recreating these items inside test harness can become very cumbersome if you have to create a large injection heirarchy. Consider the following example.</p>
<p><a title="FlexUnit4 &amp; Parsley" href="http://www.betadesigns.co.uk/Blog/2010/04/29/flexunit4-parsley/" target="_blank">More</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/4450/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom FlashBuilder Component Views</title>
		<link>http://blog.lab49.com/archives/4449</link>
		<comments>http://blog.lab49.com/archives/4449#comments</comments>
		<pubDate>Mon, 10 May 2010 21:51:50 +0000</pubDate>
		<dc:creator>Anthony McCormick</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Advanced Component Development]]></category>
		<category><![CDATA[Custom components]]></category>
		<category><![CDATA[design.xml]]></category>
		<category><![CDATA[FlashBuilder]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[manifest.xml]]></category>
		<category><![CDATA[swc]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/?p=4449</guid>
		<description><![CDATA[I recently discovered that you can create custom components that can appear under your own company/personal folder inside Flash/Flexbuilder design view. Normally any custom component you create will appear under the Custom folder in the Components View and well thats not very good for branding now is it. In addition you also get an actual [...]]]></description>
			<content:encoded><![CDATA[<p>I recently discovered that you can create custom components that can appear under your own company/personal folder inside Flash/Flexbuilder design view. Normally any custom component you create will appear under the Custom folder in the Components View and well thats not very good for branding now is it. In addition you also get an actual size representation of your component in Design view rather than just an empty box outline. For example the first image is the default and the second the custom.</p>
<p><a title="Custom FlashBuilder Component Views" href="http://www.betadesigns.co.uk/Blog/2010/05/06/custom-flashbuilder-component-views/" target="_blank">more</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/4449/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saffron is still alive!</title>
		<link>http://www.michelboudreau.com/2010/04/30/saffron-is-still-alive/</link>
		<comments>http://www.michelboudreau.com/2010/04/30/saffron-is-still-alive/#comments</comments>
		<pubDate>Mon, 03 May 2010 14:28:30 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
Every year, I try to attend FITC Toronto to learn, play, network and recharge my creative battery.  There&#8217;s a lot of things that you can learn about the industry and the technology at this amazing conference.
Now, let&#8217;s do a small recap; in 2007, not long after the introduction of AIR, an ambitious project surfaced called [...]]]></description>
			<content:encoded><![CDATA[<p>Every year, I try to attend FITC Toronto to learn, play, network and recharge my creative battery.  There&#8217;s a lot of things that you can learn about the industry and the technology at this amazing conference.<br />
Now, let&#8217;s do a small recap; in 2007, not long after the introduction of AIR, an ambitious project surfaced called [...]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/04/30/saffron-is-still-alive/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Builder &amp; Flex 4 Review</title>
		<link>http://www.michelboudreau.com/2010/05/01/flash-builder-flex-4-review/</link>
		<comments>http://www.michelboudreau.com/2010/05/01/flash-builder-flex-4-review/#comments</comments>
		<pubDate>Mon, 03 May 2010 14:28:29 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When Flex 4 beta was released, I glanced over it quickly and sighed at several facts about it.  I didn&#8217;t use it in my work since using beta software in enterprise applications would essentially signing my death warrant.  I noticed a lot of other blogs mention the pros and cons about it. My [...]]]></description>
			<content:encoded><![CDATA[<p>When Flex 4 beta was released, I glanced over it quickly and sighed at several facts about it.  I didn&#8217;t use it in my work since using beta software in enterprise applications would essentially signing my death warrant.  I noticed a lot of other blogs mention the pros and cons about it. My [...]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/05/01/flash-builder-flex-4-review/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RichTextArea Component</title>
		<link>http://www.michelboudreau.com/2010/03/18/richtextarea-component/</link>
		<comments>http://www.michelboudreau.com/2010/03/18/richtextarea-component/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 15:35:40 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[A few months ago, I was working on a project that needed a CMS backend to create content that will be displayed in Flex.  We used a RichTextEditor component to create appropriate HTML so that it would display like we wanted to on the frontend.
The problem with this approach is that we needed our [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I was working on a project that needed a CMS backend to create content that will be displayed in Flex.  We used a RichTextEditor component to create appropriate HTML so that it would display like we wanted to on the frontend.<br />
The problem with this approach is that we needed our [...]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/03/18/richtextarea-component/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PureMVC to Parsley</title>
		<link>http://www.sammur.com/?p=3</link>
		<comments>http://www.sammur.com/?p=3#comments</comments>
		<pubDate>Mon, 25 Jan 2010 13:53:13 +0000</pubDate>
		<dc:creator>Farid Sammur</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/?p=4011</guid>
		<description><![CDATA[An overview of the transition from PureMVC to Parsley.]]></description>
			<content:encoded><![CDATA[<p>An overview of the transition from PureMVC to Parsley.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sammur.com/?p=3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is Silverlight overtaking both Flex and AIR?</title>
		<link>http://feedproxy.google.com/~r/MarcusWhitworth/~3/VQiKxGrDvQw/</link>
		<comments>http://feedproxy.google.com/~r/MarcusWhitworth/~3/VQiKxGrDvQw/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 19:53:05 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=101</guid>
		<description><![CDATA[Reading the feature list of the upcoming Silverlight 4 release (now in beta), I am more than a bit impressed.  Up to now, there has been a few glaring features by which Silverlight was trailing behind Flex - camera/mic input; printing; clipboard access; and right-to-left text being ones that spring to mind.  Admittedly, all of [...]]]></description>
			<content:encoded><![CDATA[<p>Reading <a href="http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx" >the feature list</a> of the upcoming Silverlight 4 release (now in beta), I am more than a bit impressed.  Up to now, there has been a few glaring features by which Silverlight was trailing behind Flex &#8211; camera/mic input; printing; clipboard access; and right-to-left text being ones that spring to mind.  Admittedly, all of these are fairly niche features which most applications wouldn&#8217;t require.</p>
<p>Silverlight 4 not only brings in all these features, but also a pile of others.  Interestingly, they seem to be making a direct pitch against Adobe AIR with many of the features.  The new Elevated Trust Applications feature (for out-of-browser apps), enables a host of features typically reserved for desktop applications: <a href="http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#localfiles" >Local file access</a>; <a href="http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#toast" >Notifications API</a>; <a href="http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#fullscreen" >Full-screen full-keyboard access</a>; <a href="http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#xdomain" >Cross-domain policy-free networking</a>; and <a href="http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#droptarget" >Drop targets</a>.  Of course, features aside, the huge advantage of the Silverlight desktop approach over AIR is that there is only one runtime plugin required.</p>
<p>At the speed Microsoft is moving forward with Silverlight, Adobe is going to have to start seriously upping their commitment to the Flash platform if they want to stay at the top of the game.  Up to now, they could always give the argument of Flex being more feature-rich, and the ease of adaptation to the desktop with AIR &#8211; with both of these arguments now void, and Microsoft firmly remaining miles ahead in the developer tooling scene, Adobe&#8217;s work is cut out.  They still have greater marketplace penetration with Flash player, but that lead is only going to narrow also.</p>
<p>You&#8217;ve got to love competition!</p>
<p>
		<a href="http://www.dotnetkicks.com/kick/?title=Is%20Silverlight%20overtaking%20both%20Flex%20and%20AIR?&#038;url=http%3A%2F%2Fwww.marcuswhitworth.com%2F2009%2F11%2Fis-silverlight-overtaking-both-flex-and-air%2F"><br />
		<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3A%2F%2Fwww.marcuswhitworth.com%2F2009%2F11%2Fis-silverlight-overtaking-both-flex-and-air%2F" border="0" alt="Kick It on DotNetKicks.com" /> </a></p>
<p align="left"><a  class="tt" href="http://twitter.com/home/?status=Is+Silverlight+overtaking+both+Flex+and+AIR%3F+www.bit.ly/1LS0o7" title="Post to Twitter"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.marcuswhitworth.com/2009/11/is-silverlight-overtaking-both-flex-and-air/&amp;submitHeadline=Is+Silverlight+overtaking+both+Flex+and+AIR%3F" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-buzz-micro3.png" alt="Post to Yahoo Buzz" /></a> <a  class="tt" href="http://delicious.com/post?url=http://www.marcuswhitworth.com/2009/11/is-silverlight-overtaking-both-flex-and-air/&amp;title=Is+Silverlight+overtaking+both+Flex+and+AIR%3F" title="Post to Delicious"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-delicious-micro3.png" alt="Post to Delicious" /></a> <a  class="tt" href="http://digg.com/submit?url=http://www.marcuswhitworth.com/2009/11/is-silverlight-overtaking-both-flex-and-air/&amp;title=Is+Silverlight+overtaking+both+Flex+and+AIR%3F" title="Post to Digg"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a  class="tt" href="http://reddit.com/submit?url=http://www.marcuswhitworth.com/2009/11/is-silverlight-overtaking-both-flex-and-air/&amp;title=Is+Silverlight+overtaking+both+Flex+and+AIR%3F" title="Post to Reddit"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a> <a  class="tt" href="http://stumbleupon.com/submit?url=http://www.marcuswhitworth.com/2009/11/is-silverlight-overtaking-both-flex-and-air/&amp;title=Is+Silverlight+overtaking+both+Flex+and+AIR%3F" title="Post to StumbleUpon"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-su-micro3.png" alt="Post to StumbleUpon" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MarcusWhitworth?a=VQiKxGrDvQw:AM38r91CRwc:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MarcusWhitworth?i=VQiKxGrDvQw:AM38r91CRwc:D7DqB2pKExk" border="0"></img></a>
</div>
<p><img src="http://feeds.feedburner.com/~r/MarcusWhitworth/~4/VQiKxGrDvQw" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/MarcusWhitworth/~3/VQiKxGrDvQw/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Morgan Stanley’s Matrix webcast recording</title>
		<link>http://feedproxy.google.com/~r/dhruba/lab49/~3/2UKiBE1jWls/</link>
		<comments>http://feedproxy.google.com/~r/dhruba/lab49/~3/2UKiBE1jWls/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 22:35:36 +0000</pubDate>
		<dc:creator>Dhruba Bandopadhyay</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Lab49]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://dhruba.name/?p=1209</guid>
		<description><![CDATA[
A month back a live webcast took place titled &#8216;Transcending the client experience&#8217; that focused primarily on the use of RIA in financial services and particularly within Morgan Stanley&#8217;s Matrix.  A recording of the webcast is now available.  I offer a small summary of some of the highlights here.
RIA offers a zero footprint [...]]]></description>
			<content:encoded><![CDATA[</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="227" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=6245546&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="227" src="http://vimeo.com/moogaloop.swf?clip_id=6245546&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>A month <a href="http://mdavey.wordpress.com/2009/07/21/ria-matrix-webcast/">back</a> a live webcast took place titled &#8216;Transcending the client experience&#8217; that focused primarily on the use of RIA in financial services and particularly within Morgan Stanley&#8217;s Matrix.  A recording of the webcast is now available.  I offer a small summary of some of the highlights here.</p>
<p>RIA offers a zero footprint in terms of installation effort and supports real time data presentation through simple yet rich user interfaces.  It is bringing the business closer to its clients and is more than just technology in that it is solving real world business problems.</p>
<p>The progressive trends are as follows.  There is a front-end shift in that applications are now more driven by user experience and design than previously, can represent large amounts of varied and real time data more coherently and concisely and are increasingly beginning to approximate thick clients in that they are stateful and taking on more of the responsibilities of the server side.</p>
<p>Going forward opportunity is seen in adding threading support and mobile device support to Flex and also in migrating the vast amount of legacy applications currently existing to RIA technology.  Morgan Stanley&#8217;s Matrix received special recognition throughout being one of the largest production Flex applications in the world, if not the largest, at more than six hundred thousand lines of code developed in the timeframe of a year.</p>
<p>[ Recording of the "Transcending the Client Experience webcast", organised by Adobe and Finextra. Participants in this hour and a quarter long session discuss how developers at financial firms use rich Internet application technologies to integrate real-time data, with the delivery of audio, video, reports and rich interactive charts to trading applications.]</p>
<p>[Panel participants: Hishaam Mufti-Bey (Matrix founder and global director at Morgan Stanley), Stephane Malrait (Global Head of eCommerce at Societe Generale), Mark Greenaway (Adobe), Trevor LaFleche (Senior Analyst at Financial Insights).  Moderator: Vivake Gupta, Managing Director, Lab49.]</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fdhruba.name%2F2009%2F08%2F25%2Fmorgan-stanleys-matrix-webcast-recording%2F&amp;linkname=Morgan%20Stanley%26%238217%3Bs%20Matrix%20webcast%20recording"><img src="http://dhruba.name/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>
<p><img src="http://feeds.feedburner.com/~r/dhruba/lab49/~4/2UKiBE1jWls" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/dhruba/lab49/~3/2UKiBE1jWls/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where to begin?</title>
		<link>http://feedproxy.google.com/~r/MarcusWhitworth/~3/2eHClHmyTb4/</link>
		<comments>http://feedproxy.google.com/~r/MarcusWhitworth/~3/2eHClHmyTb4/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 09:14:40 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=4</guid>
		<description><![CDATA[So I've been thinking about what I could kick start this blog with - stuff in which I've developed a bit of a niche and have something to share with a wider audience.  My background has been primarily in web-based application development, with the tools focused largely within the .NET and the RIA spaces. I [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been thinking about what I could kick start this blog with &#8211; stuff in which I&#8217;ve developed a bit of a niche and have something to share with a wider audience.  My background has been primarily in web-based application development, with the tools focused largely within the .NET and the RIA spaces.</p>
<p>I recently helped <a href="http://codertron.blogspot.com/" >a colleague</a> out with an article on <a href="http://codertron.blogspot.com/2009/05/flex-3-versus-silverlight-3-in.html" >Flex vs. Silverlight in the Enterprise</a>.  Both of us have a strong .NET background, and have more recently been heavily involved on a massive enterprise-scale Flex application.  Although  I still stand by the original article, I realise it&#8217;s impossible to accurately and fairly detail each platforms&#8217; strengths and weaknesses in one post.</p>
<p>So, I plan to start a bit of a series &#8211; comparing different user experiences as created with Silverlight and Flex, and hopefully reaching a conclusion on the benefits of each platform, based upon developer experience/efficiency, and of course how the end result meets the original client requirements.</p>
<p>Each post will focus on a technical area that you may find within any enterprise RIA.  Example areas could be video streaming, datagrid customisation, push messaging, theming/skinning, just to name a few.</p>
<p>It&#8217;s as much for my own benefit as anyone else&#8217;s &#8211; in order to deliver the best client experience, you HAVE to know what the best tools or platform are for any given situation!</p>
<p>
		<a href="http://www.dotnetkicks.com/kick/?title=Where%20to%20begin?&#038;url=http%3A%2F%2Fwww.marcuswhitworth.com%2F2009%2F08%2Fwhere-to-begin%2F"><br />
		<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3A%2F%2Fwww.marcuswhitworth.com%2F2009%2F08%2Fwhere-to-begin%2F" border="0" alt="Kick It on DotNetKicks.com" /> </a></p>
<p align="left"><a  class="tt" href="http://twitter.com/home/?status=Where+to+begin%3F+www.bit.ly/5zDqVP" title="Post to Twitter"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.marcuswhitworth.com/2009/08/where-to-begin/&amp;submitHeadline=Where+to+begin%3F" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-buzz-micro3.png" alt="Post to Yahoo Buzz" /></a> <a  class="tt" href="http://delicious.com/post?url=http://www.marcuswhitworth.com/2009/08/where-to-begin/&amp;title=Where+to+begin%3F" title="Post to Delicious"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-delicious-micro3.png" alt="Post to Delicious" /></a> <a  class="tt" href="http://digg.com/submit?url=http://www.marcuswhitworth.com/2009/08/where-to-begin/&amp;title=Where+to+begin%3F" title="Post to Digg"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a  class="tt" href="http://reddit.com/submit?url=http://www.marcuswhitworth.com/2009/08/where-to-begin/&amp;title=Where+to+begin%3F" title="Post to Reddit"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a> <a  class="tt" href="http://stumbleupon.com/submit?url=http://www.marcuswhitworth.com/2009/08/where-to-begin/&amp;title=Where+to+begin%3F" title="Post to StumbleUpon"><img class="nothumb" src="http://www.marcuswhitworth.com/wp-content/plugins/tweet-this/icons/tt-su-micro3.png" alt="Post to StumbleUpon" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MarcusWhitworth?a=2eHClHmyTb4:NqpQHl-S9Gg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MarcusWhitworth?i=2eHClHmyTb4:NqpQHl-S9Gg:D7DqB2pKExk" border="0"></img></a>
</div>
<p><img src="http://feeds.feedburner.com/~r/MarcusWhitworth/~4/2eHClHmyTb4" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/MarcusWhitworth/~3/2eHClHmyTb4/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex in finance</title>
		<link>http://blog.lab49.com/archives/2940</link>
		<comments>http://blog.lab49.com/archives/2940#comments</comments>
		<pubDate>Thu, 26 Mar 2009 10:00:12 +0000</pubDate>
		<dc:creator>Alex Vandenberg</dc:creator>
				<category><![CDATA[Finance]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/archives/2940</guid>
		<description><![CDATA[Recently I&#8217;ve been taking a break from the joys of C# and Winforms and have been having a look at Actionscript and Flex. Looking through Flex livedocs I noticed this paragraph on their description of the Flex &#8220;Number&#8221; data type. “Although this range of numbers is enormous, the cost of this range is precision. The [...]]]></description>
			<content:encoded><![CDATA[<p style="line-height: 14.25pt;"><span style="font-size: 10pt; color: black; font-family: &quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;">Recently I&#8217;ve been taking a break from the joys of C# and Winforms and have been having a look at Actionscript and Flex. Looking through Flex livedocs I noticed this paragraph on their description of the Flex &#8220;Number&#8221; data type.</span></p>
<p style="line-height: 14.25pt;"><span style="font-size: 10pt; color: black; font-family: &quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;">“Although this range of numbers is enormous, the cost of this range is precision. The Number data type uses 52 bits to store the significand, with the result that numbers that require more than 52 bits to represent precisely, such as the fraction 1/3, are only approximations. If your application requires absolute precision with decimal numbers, you need to use software that implements decimal floating-point arithmetic as opposed to binary floating-point arithmetic.”</span></p>
<p style="line-height: 14.25pt;"><span style="font-size: 10pt; color: black; font-family: &quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;">Seems to me they’re basically saying that if you have an app where number precision is important, then don’t use Flex. While Flex can create some great looking applications, my impressions are that for financial and LOB applications – Silverlight with the pedigree of C# and the wide range of 3rd party controls and tools should be the first choice.</span></p>
<p style="line-height: 14.25pt;"><span style="font-size: 10pt; color: black; font-family: &quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;">Update: I’ve just found a 3<sup>rd</sup> party library with a simplified implementation of the decimal data type. <a href="http://www.fxcomps.com/components.html"><span style="color: #800080;">http://www.fxcomps.com/components.html</span></a> Naturally Flex is extensible, so it’s possible to solve most problems one way or another.<span style="mso-spacerun: yes;">  </span>However it’s nicer to have an out of the box solution where things like this are present without you having to even think about it.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/2940/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find security vulnerabilities in Flex applications</title>
		<link>http://www.borrewessel.com/?p=45</link>
		<comments>http://www.borrewessel.com/?p=45#comments</comments>
		<pubDate>Mon, 23 Mar 2009 19:02:46 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=45</guid>
		<description><![CDATA[HP has launched a new tool to find security vulnerabilities in Flash/Flex applications, SWFScan. Looks quite promising, this is how it does it:

Decompiles and analyzes the application to identify security issues.
Identifies insecure code, and deployment setup.
No need for access to the code
And it is Free

Definitely worth trying, finally someone creates a tool to address Flash [...]]]></description>
			<content:encoded><![CDATA[<p>HP has launched a new tool to find security vulnerabilities in Flash/Flex applications, <a href="http://www.hp.com/go/swfscan">SWFScan</a>. Looks quite promising, this is how it does it:</p>
<ul>
<li>Decompiles and analyzes the application to identify security issues.</li>
<li>Identifies insecure code, and deployment setup.</li>
<li>No need for access to the code</li>
<li>And it is Free</li>
</ul>
<p>Definitely worth trying, finally someone creates a tool to address Flash security. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=45/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stubbing Flex HTTPServices</title>
		<link>http://www.borrewessel.com/?p=24</link>
		<comments>http://www.borrewessel.com/?p=24#comments</comments>
		<pubDate>Tue, 24 Feb 2009 22:46:27 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=24</guid>
		<description><![CDATA[On a few projects I have worked on there has been necessary to stub the Flex HttpServices. A couple of reasons has been, server side code is not ready yet or services are too unstable to support a continuous UI development.
I have seen examples where there has been spent a lot of time developing code [...]]]></description>
			<content:encoded><![CDATA[<p>On a few projects I have worked on there has been necessary to stub the Flex HttpServices. A couple of reasons has been, server side code is not ready yet or services are too unstable to support a continuous UI development.</p>
<p>I have seen examples where there has been spent a lot of time developing code to accommodate for this, with the only result that code base has a lot of non production code which can cause bugs and add an overhead to maintenance of the system. In my eyes that would be wrong, test/mock coding is money wasted on valuable time that should be spent on developing features.</p>
<p>So why not use something which already (almost) exist. When you use HTTPServices, you can point to nearly anything that gives you some kind of XML result. Pointing to a static XML file on the server should give you almost the same as pointing to a service which would serve you dynamic XML.</p>
<pre>

package com.lab49.spike
{
	import mx.core.Application;

	import mx.rpc.AsyncToken;
	import mx.rpc.http.mxml.HTTPService;

	public class StubHttpService extends HTTPService
	{
		public var stubUrl : String = &quot;&quot;;

		private function get stub() : Boolean
		{
			var stubParam : String = String( Application.application.parameters[ &quot;stub&quot; ] );

			return stubParam == &quot;true&quot;;
		}

		public override function send( param : Object  = null ) : AsyncToken
		{
			if( stub )
			{
				url = stubUrl
			}

			return super.send( param );
		}
	}
}
</pre>
<p>And when you use it, insert &#8220;stub=true&#8221; in your url, and add this to your StubHTTPService:</p>
<pre>

&lt;spike:StubHttpService
	url=&quot;http://localhost:8080/spike/myService&quot;
	stubUrl=&quot;xml/stub.xml&quot;
	...
/&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=24/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mission critical Flex application</title>
		<link>http://www.borrewessel.com/?p=13</link>
		<comments>http://www.borrewessel.com/?p=13#comments</comments>
		<pubDate>Mon, 09 Feb 2009 23:20:56 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=13</guid>
		<description><![CDATA[One of my previous projects were showcased on Adobe Max 2008 in San Francisco, a mission planning system for NATO AWACS, E-3A Component, presented by Peter Martin and Mansour Raad.
The application was built based on Flex, LiveCycle DataServices and Oracle, one of the main components used within Flex was the ESRI mapping api.
The presentation is [...]]]></description>
			<content:encoded><![CDATA[<p>One of my previous projects were showcased on Adobe Max 2008 in San Francisco, a mission planning system for NATO AWACS, E-3A Component, presented by <a title="Peter Martin" href="http://weblogs.macromedia.com/pmartin">Peter Martin</a> and <a title="Mansour Raad" href="http://thunderheadxpler.blogspot.com/">Mansour Raad</a>.<br />
The application was built based on Flex, LiveCycle DataServices and Oracle, one of the main components used within Flex was the ESRI mapping api.</p>
<p>The presentation is available on <a title="AdobeTV" href="http://tv.adobe.com/#vi+f15384v1096">AdobeTV</a>.</p>
<p>Who said Adobe Flex couldn&#8217;t be used for critical systems? <img src='http://www.borrewessel.com/wp-includes/images/smilies/icon_smile.gif' alt=')' class='wp-smiley' /> If Adobe wants Flex to be seen as a serious framework in the enterprise, this is the kind of projects they need to show more of.</p>
<p>Over a series of posts I will cover some of the experiences gathered from this and other projects I have taken part in. There is usually more to a project then just choosing a framework like Cairngorm, PureMVC or one of the many IoC containers which are popping up everywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PureMVC</title>
		<link>http://blog.lab49.com/archives/2489</link>
		<comments>http://blog.lab49.com/archives/2489#comments</comments>
		<pubDate>Wed, 13 Aug 2008 22:59:38 +0000</pubDate>
		<dc:creator>Daniel Chait</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/?p=2489</guid>
		<description><![CDATA[Cross-language implementation of the MVC meta-pattern &#8211; PureMVC. Supported languages: ActionScript 2 ActionScript 3 C# ColdFusion haXe Java Perl PHP Python Ruby]]></description>
			<content:encoded><![CDATA[<p>Cross-language implementation of the MVC meta-pattern &#8211; <a href="http://puremvc.org/">PureMVC</a>.  Supported languages:</p>
<ul>
<li>ActionScript 2</li>
<li>ActionScript 3</li>
<li>C#</li>
<li>ColdFusion</li>
<li>haXe</li>
<li>Java</li>
<li>Perl</li>
<li>PHP</li>
<li>Python</li>
<li>Ruby</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/2489/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Scotch on the Rocks, day 3</title>
		<link>http://www.borrewessel.com/?p=10</link>
		<comments>http://www.borrewessel.com/?p=10#comments</comments>
		<pubDate>Mon, 09 Jun 2008 08:42:39 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=10</guid>
		<description><![CDATA[My second presentation at Scotch On the Rocks was Flex Client Architecture &#38; Best Practices. The one topic in the presentation which gained most attention was probably PresentationModels. I would say there is not really any magic to how to use PresentationModels, but it is more down to what kind of logic you put there [...]]]></description>
			<content:encoded><![CDATA[<p>My second presentation at Scotch On the Rocks was <a href="https://share.acrobat.com/adc/document.do?docid=c8ae0f12-5678-4110-84a9-84cb22f75ebf">Flex Client Architecture &amp; Best Practices</a>. The one topic in the presentation which gained most attention was probably PresentationModels. I would say there is not really any magic to how to use PresentationModels, but it is more down to what kind of logic you put there and how it relates to your services. The PresentationModel pattern is also independent of any framework you would put on top of Flex.</p>
<p>If you have an interest in presentation patterns, I would recommend to look at <a href="http://weblogs.macromedia.com/paulw/">Paul Williams</a> great presentation pattern blog series. He also has a series covering how to unit test the different patterns, which most developers should find interesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scotch on the Rocks, day 2</title>
		<link>http://www.borrewessel.com/?p=9</link>
		<comments>http://www.borrewessel.com/?p=9#comments</comments>
		<pubDate>Thu, 05 Jun 2008 13:03:21 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=9</guid>
		<description><![CDATA[Today I had the first of two presentations I will have at Scotch on the Rocks 2008, todays topic was Modularizing Flex applications - Cairngorm &#38; Modules. It was good to see so many Coldfusion ( and Flex ) developers being interested in how to use Flex modules and Cairngorm.
Tomorrow I will present &#8220;Flex Client [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had the first of two presentations I will have at Scotch on the Rocks 2008, todays topic was <a href="https://share.acrobat.com/adc/document.do?docid=8460658d-9900-4379-8855-09621d32222d">Modularizing Flex applications &#8211; Cairngorm &amp; Modules</a>. It was good to see so many Coldfusion ( and Flex ) developers being interested in how to use Flex modules and Cairngorm.</p>
<p>Tomorrow I will present &#8220;Flex Client Architecture &amp; Best Practices&#8221;, where topics like PresentationModel and unit testing will be covered.</p>
<p>As I also announced on 360|Flex Europe in Milan, Adobe Consulting will over the next few months share some of our best practices in a series of articles. A topic could be for example &#8220;Cairngorm and Modules&#8221;. Steven Webster has posted a <a href="http://weblogs.macromedia.com/swebster/archives/2008/05/cairngorm_tech.html">call for topics</a> blog post</p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cairngorm Deepdive</title>
		<link>http://www.borrewessel.com/?p=8</link>
		<comments>http://www.borrewessel.com/?p=8#comments</comments>
		<pubDate>Fri, 11 Apr 2008 15:18:16 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=8</guid>
		<description><![CDATA[On Wednesday I had the pleasure of presenting &#8220;Cairngorm Deepdive&#8221; at 360&#124;Flex Europe. Thanks to
Tom and John for organizing the first 360&#124;Flex in Europe
Presentation Cairngorm Deepdive
]]></description>
			<content:encoded><![CDATA[<p>On Wednesday I had the pleasure of presenting &#8220;Cairngorm Deepdive&#8221; at 360|Flex Europe. Thanks to<br />
<a href="http://lordbron.wordpress.com/">Tom</a> and <a href="http://johnwilker.com/">John</a> for organizing the first 360|Flex in Europe</p>
<p>Presentation <a href="https://share.acrobat.com/adc/document.do?docid=a0d01f34-42a2-42e2-b712-2d733e8f0044">Cairngorm Deepdive</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=8/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>360&#124;Flex Europe &#8211; Cairngorm deepdive</title>
		<link>http://www.borrewessel.com/?p=7</link>
		<comments>http://www.borrewessel.com/?p=7#comments</comments>
		<pubDate>Thu, 27 Mar 2008 00:29:20 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=7</guid>
		<description><![CDATA[It is now less than 2 weeks left till 360&#124;Flex Europe kicks off in Milan, Italy. And looking at the list of topics being presented, it&#8217;s going to be a great conference!
In my presentation - Cairngorm deepdive, I&#8217;ll be covering some of the history behind the Cairngorm Microarhitecture, how to use it on large scale [...]]]></description>
			<content:encoded><![CDATA[<p>It is now less than 2 weeks left till <a href="http://www.360flex.com/360flex_Europe/">360|Flex Europe</a> kicks off in Milan, Italy. And looking at the list of topics being presented, it&#8217;s going to be a great conference!</p>
<p>In my presentation &#8211; <a href="http://www.360flex.com/360Flex_Europe/2008/03/360flex-gets-deep-with-cairngorm.html">Cairngorm deepdive</a>, I&#8217;ll be covering some of the history behind the Cairngorm Microarhitecture, how to use it on large scale projects, how to handle security, and also shed some light on the future of the framework.</p>
<p>There is also a second presentation covering Cairngorm, Neil Webb will present <a href="http://nwebb.co.uk/blog/?p=154">Cairngorm for beginners</a>.</p>
<p>If you haven&#8217;t already signed up for the conference, you can do so <a href="http://360flexeurope.eventbrite.com/">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Service Chaining in Flex</title>
		<link>http://blog.lab49.com/archives/1760</link>
		<comments>http://blog.lab49.com/archives/1760#comments</comments>
		<pubDate>Thu, 21 Feb 2008 00:28:10 +0000</pubDate>
		<dc:creator>Jason Dolinger</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.lab49.com/archives/1760</guid>
		<description><![CDATA[For my latest project I've been working on a set of related portals with the UI written in Adobe Flex, communicating with a set of REST services.  A common requirement that I've seen amongst these are to call a set of services at startup to load various initialization and configuration data, use that data to initialize a set of controls, and then allow the user to begin interacting with the app.  

Given the asynchronous nature of making service calls in Flex (or Ajax apps or any other RIA technology) you can run into race conditions if you simply fire off all of the service calls at once, especially if the result handler of one service has a dependency on a piece of data that was loaded from a different service.  Additionally, you need to be notified of when all the initialization services have finished so you can perform any rendering actions to make the app available for business.]]></description>
			<content:encoded><![CDATA[<p>For my latest project I&#8217;ve been working on a set of related portals with the UI written in Adobe Flex, communicating with a set of REST services.  A common requirement that I&#8217;ve seen amongst these are to call a set of services at startup to load various initialization and configuration data, use that data to initialize a set of controls, and then allow the user to begin interacting with the app.  </p>
<p>Given the asynchronous nature of making service calls in Flex (or Ajax apps or any other RIA technology) you can run into race conditions if you simply fire off all of the service calls at once, especially if the result handler of one service has a dependency on a piece of data that was loaded from a different service.  Additionally, you need to be notified of when all the initialization services have finished so you can perform any rendering actions to make the app available for business.<br />
(A concrete example of this would be an app that needs to load a list of position dates from a service, and will then pick the latest position date as a parameter into a number of other service calls that populate DataGrids on the screen.  You must defer the calls to load each grid until the positionDates service has returned).</p>
<p>The first approach that my team had to implementing this would be to fire off the first service in the creationComplete handler of the application, then at the end of that service&#8217;s result handler fire off the second service, and so on.  Given an application with two HTTPServices (svc1 and svc2) declared and a creationComplete event handler to kick the processing off, a contrived example of this would look like this:</p>
<pre>
private function onCreateComplete(event:Event):void
{

    // wire service result handlers
    svc1.addEventListener(ResultEvent.RESULT, result1);
    svc2.addEventListener(ResultEvent.RESULT, result2);

    // invoke first service
    svc1.send();

}

private function result1(event:ResultEvent):void
{
    // do something with the result of svc1, then invoke
    // svc2
    svc2.send();
}

private function result2(event:ResultEvent):void
{
    // do something with the results of service 2, then
    // perform actions to make app available
}
</pre>
<p>This type of design quickly grew brittle and unmanageable.  Readability is forfeited as you need to navigate around all of your event handling methods to discern the ordering of events.  Adding new service calls or changing the order becomes an exercise in figuring out where to insert the next call and how to hook it up into the flow.  If you have certain subclasses of your application class that needed additional service calls (as my project does), it is difficult to insert a new service into the flow.  </p>
<p>As a piece of refactoring, I created a neat little class to give us an easy way to put the ordering of the services in one central location, decoupling the service flow from the result handlers. It maintains an internal list of services to call, in the order that they are added to the chain.  When you add an HTTPService (and it&#8217;s corresponding event handler) to the chain, a generic event handler is added to listen for the result event.  When this handler is invoked, it&#8217;ll call the actual event handler that you provided for that service, and will then pop the next service off the chain and call it.  You can also specify a final handler method to be called once all the services in the chain are finished:</p>
<pre>
public class ServiceChain
{
    private var _chain:Array = new Array();
    private var _curEntry:Object;
    private var _chainFinishedHandler:Function;
    public function ServiceChain()
    {
        super();
    }

    /**
     * @param f
     * Setter for the chainFinishedHandler, a method that will be
     * invoked when the final service has returned.
     */
    public function set chainFinishedHandler(f:Function):void {
	_chainFinishedHandler = f;
    }

    /**
     * @param svc
     * @param resultHandler
     *
     * Adds a chain entry for the HTTPService and resultHandler pair
     * (added as an anonymous object with svcclass and handler
     * properties).  An event listener is added to the svc class to
     * invoke the genericOnServiceResult when the service returns.
     */
    public function add(svc:HTTPService, resultHandler:Function):void
    {
        // redirect the results of all service calls to the generic handler
        svc.addEventListener(ResultEvent.RESULT, genericOnServiceResult);
        _chain.push({svcclass: svc, handler: resultHandler});
    }

    /**
     * Pick the next service off the chain and invoke it's send method.
     * If there is no service on the queue, we are finished.  Invoke the
     * chainFinishedHandler if present.
     */
    public function run():void
    {
        _curEntry = _chain.shift();
        if (_curEntry == null) {
            if (_chainFinishedHandler != null)
                _chainFinishedHandler();
            return;
        }
        _curEntry.svcclass.send();
    }

    /**
     * @param event
     *
     * The service has returned, so invoke the actual event handler for the
     * service, then call run() to pick the next service from the chain.
     */
    private function genericOnServiceResult(event:ResultEvent):void
    {
        _curEntry.handler(event);
        run();
    }
}
</pre>
<p>Then the application code simplifies to:</p>
<pre>
private function onCreateComplete(event:Event):void
{
	var chain:ServiceChain = new ServiceChain();
	chain.add(svc1, result1);
	chain.add(svc2, result2);
	chain.chainFinishedHandler = chainFinished;
	chain.run();
}

private function result1(event:ResultEvent):void
{
	// ... do something with the result of svc1
}

private function result2(event:ResultEvent):void
{
	// ... do something with the result of service 2
}

private function chainFinished():void
{
	// make app available
}
</pre>
<p>We&#8217;ve now decoupled the ordering of service calls from the handling of each service result, have a way for subclasses to insert their own calls to the chain (making the chain a protected member), and have an easy way to execute logic when service calls have finished.   This pattern I suppose is something akin to a Chain of Responsibility with a different flavor to handle the asynchronicity of each operation.  I&#8217;d imagine this type of thing could be useful in Flex, Silverlight, or any other rich client app which must initialize itself from remote services called asynchronously.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lab49.com/archives/1760/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Life With ActionScript and AIR: The Command Pattern Is Your Best Friend</title>
		<link>http://decav.com/blogs/andre/archive/2007/11/16/life-with-actionscript-and-air-the-command-pattern-is-your-best-friend.aspx</link>
		<comments>http://decav.com/blogs/andre/archive/2007/11/16/life-with-actionscript-and-air-the-command-pattern-is-your-best-friend.aspx#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I&#39;ve recently started a project (top secret!) using the new Adobe Integrated Runtime (AIR), Flex and ActionScript 3.0. Coming from a .NET and WPF world. this has been a step in a very different direction. There are a lot of things I don&#39;t really love about ActionScript, however it does do its job, and the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#39;ve recently started a project (top secret!) using the new Adobe Integrated Runtime (AIR), Flex and ActionScript 3.0. Coming from a .NET and WPF world. this has been a step in a very different direction. There are a lot of things I don&#39;t really love about ActionScript, however it does do its job, and the Adobe AIR deployment strategy (along with its SQLLite database) is pretty damn good. One of the first things any developer will realize when trying to build a real Rich Internet Application (RIA) in ActionScript is the lack of threading. This makes doing background tasks very difficult. ActionScript, and its class library, works largely with callback methods (either from calling setInterval, using a Timer class, calling a SQLConnection or using the HTTPService or other class to make a data call). From what I can tell, this works much like the Windows message loop, inurrupting synchronous code on your UI thread to process the callback. While this is great for simple actions (say, a UI that calls a web service or REST service ), building a background process (such as a SQL Server synchronization engine) can get complicated. Due to the number of callbacks you&#39;ll receive each time you make a request (to SQLConnection or HTTPService ), there is a great amount of complexity in writing simple procedual background processes (that don&#39;t freeze up the UI). To better handle this situation, and ensure that your discrete functions run in the proper order (for example, Authenticate -&gt; Get Data), a command pattern in ActionScript will become your best friend. You can string together multiple callbacks, and ensure that the code for these operations stay in one logical class. Furthermore, by using a queue, you can order your commands such that they run synchronously. This provides much more flexibility than the traditional scripting approach in ActionScript. Unfortunately, I cannot currently provide code samples, as I do not want to compromise the intellectual property of my project, however, I hope that this will help you get an idea of how to best manage your code and synchronous operations in .NET. Side Note: If you&#39;re using WCF I suggest you use the Basic HTTP Binding with Flex, as FlexBuilder gets confused with .NET Web Services</p>
]]></content:encoded>
			<wfw:commentRss>http://decav.com/blogs/andre/archive/2007/11/16/life-with-actionscript-and-air-the-command-pattern-is-your-best-friend.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>“Using Adobe Flex with Rails” tutorial at RailsConf Europe</title>
		<link>http://www.borrewessel.com/?p=6</link>
		<comments>http://www.borrewessel.com/?p=6#comments</comments>
		<pubDate>Mon, 17 Sep 2007 22:30:12 +0000</pubDate>
		<dc:creator>Borre Wessel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.borrewessel.com/?p=6</guid>
		<description><![CDATA[Today I&#8217;m presenting at RailsConf Europe in Berlin together with Aslak Hellesøy from Bekk Consulting. Todays tutorial is &#8220;Using Adobe Flex with Rails&#8221;, the tutorial is all about how to combine two great tools to quickly develop nice looking and compelling applications. It is really interesting to see what the Rails community is doing with [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;m presenting at RailsConf Europe in Berlin together with <a href="http://blog.aslakhellesoy.com/">Aslak Hellesøy</a> from <a href="http://www.bekk.no/">Bekk Consulting</a>. Todays tutorial is &#8220;Using Adobe Flex with Rails&#8221;, the tutorial is all about how to combine two great tools to quickly develop nice looking and compelling applications. It is really interesting to see what the Rails community is doing with BDD (Behavior-Driven Development), Aslaks second tutorial of the day, and rapid prototyping.</p>
<p>Both Rails and Flex are considered &#8220;best in class&#8221; when it comes to rapid development, and during todays 3.5 hour session we will show how Flex can integrate with Rails using a REST based back-end.</p>
<p>The presentation can be found <a href="https://share.acrobat.com/adc/document.do?docid=1455f64a-3e78-45fe-8112-ceeb87eeac88">here</a>, and the code is on <a href="http://code.google.com/p/attender/">google code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.borrewessel.com/?p=6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

