<?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>Digital Primates&#187; codeslinger</title>
	<atom:link href="http://www.digitalprimates.net/author/author/codeslinger/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.digitalprimates.net</link>
	<description>Flex Development and Consulting</description>
	<lastBuildDate>Thu, 12 Jan 2012 18:30:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Talking Trash &#8211; An overview of Player GC</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2011/10/11/talking-trash-an-overview-of-player-gc/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2011/10/11/talking-trash-an-overview-of-player-gc/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 17:42:16 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[flashplayer]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[flash player]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[internals]]></category>

		<guid isPermaLink="false">http://www.digitalprimates.net/?p=877</guid>
		<description><![CDATA[Okay, so, I have been a little behind schedule actually posting content. Here is my first attempt at reconcilliation. These are the slides from my garbage collection talk at flash and the city this year. They go into moderate depth &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2011/10/11/talking-trash-an-overview-of-player-gc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Okay, so, I have been a little behind schedule actually posting content. Here is my first attempt at reconcilliation.

These are the slides from my garbage collection talk at <a title="Flash and the City" href="http://fatc.co/" target="_blank">flash and the city</a> this year. They go into moderate depth about the internals of garbage collection on the Flash Player and AIR along with some speculation about where things may be going. The speculation is based off of commits happening on the <a title="Tamarin Project" href="http://www.mozilla.org/projects/tamarin/" target="_blank">tamarin project</a> from our friends at Adobe.

<iframe src="http://www.slideshare.net/slideshow/embed_code/9647402" width="450" height="375" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br/><br/>

&nbsp;

Cheers,

Labriola

&nbsp;

&nbsp;]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2011/10/11/talking-trash-an-overview-of-player-gc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Catching up</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2010/09/23/catching-up/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2010/09/23/catching-up/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 19:23:02 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[360Flex]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://173.236.48.58/~digit329/codeslinger/?p=151</guid>
		<description><![CDATA[360&#124;Flex is officially over and my slides are finally available. It was another great conference but I am officially wiped out. Three full days of content and wonderfully geeky discussion have left me looking forward to the weekend. For any &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2010/09/23/catching-up/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
360|Flex is officially over and my slides are finally available. It was another great conference but I am officially wiped out. Three full days of content and wonderfully geeky discussion have left me looking forward to the weekend.
</p><p>
For any who asked for my slides, they are included below. Thanks so much for the great feedback and being a wonderful audience. I really enjoy doing these deep-dive style talks and so long as 360|Flex keeps inviting me back and all of you keep attending, I promise to try to keep them fresh and interesting.
</p>
<div style="width:425px" id="__ss_5272556"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/michael.labriola/flex-4-components-from-the-firehose" title="Flex 4 components from the firehose">Flex 4 components from the firehose</a></strong><object id="__sse5272556" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=flex4componentsfromthefirehose-100923183141-phpapp02&#038;stripped_title=flex-4-components-from-the-firehose&#038;userName=michael.labriola" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse5272556" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=flex4componentsfromthefirehose-100923183141-phpapp02&#038;stripped_title=flex-4-components-from-the-firehose&#038;userName=michael.labriola" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/michael.labriola">michael.labriola</a>.</div></div>
<p>
P.S. If you didn&#8217;t get a chance, check out my featured opening over at <a href="http://www.weheartdoug.org/">http://www.weheartdoug.org</a> for Nate&#8217;s masterful prank.
</p>
<p>
Cheers,</br>
Labriola
</p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2010/09/23/catching-up/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wanted: Technical Writers with Free Time and an Altruistic Spirit</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2010/07/08/wanted-technical-writers-with-free-time-and-an-altruistic-spirit/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2010/07/08/wanted-technical-writers-with-free-time-and-an-altruistic-spirit/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 13:07:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[FlexUnit]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2010/07/08/wanted-technical-writers-with-free-time-and-an-altruistic-spirit/</guid>
		<description><![CDATA[As many of you know, I am the project lead for FlexUnit 4.x. The technical side of the project is in great shape with new features, releases and tests forthcoming, however, the place we are really lagging is good documentation. &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2010/07/08/wanted-technical-writers-with-free-time-and-an-altruistic-spirit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
As many of you know, I am the project lead for FlexUnit 4.x. The technical side of the project is in great shape with new features, releases and tests forthcoming, however, the place we are really lagging is good documentation. 
</p>
<p>
Right now the FlexUnit team is quite small and 120% of our time is occupied with development and user support. Unfortunately this means that the best engineered plans for good documentation seem to get farther behind as the days go on.
</p>
<p>
We are looking for a few people who would be willing to own large chunks of the documentation. We would arrange conference calls as needed with the developers of key sections to talk through approach, technical details and future plans. The goal would be to ensure you have a full understanding and access to anyone you need when writing. Ultimately, it would also give you a few things. 
</p>
<p>
First, you would have unlimited access to learn FlexUnit at a very, very deep level. Second, you could help create a volume of work (I am hoping we can produce both wiki content and eventually a comprehensive PDF book) which will continue to be attributed to you. Third, that attribution plus future recommendations from myself and others on the team and in this industry are guaranteed (and very helpful for future interviews). 
</p>
<p>
Anyone who is seriously interested should leave a comment on this post and I will reach out to you immediately.
</p>
<p>
If you want to take a look at our current efforts, head over to <a href="http://docs.flexunit.org/" target="_blank">docs.flexunit.org</a>
</p>
<p>
Thanks,<br/>
Labriola</br/>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2010/07/08/wanted-technical-writers-with-free-time-and-an-altruistic-spirit/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FlexUnit 4.1 Beta 1 Now Available</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2010/06/07/flexunit-41-beta-1-now-available/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2010/06/07/flexunit-41-beta-1-now-available/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 13:06:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[FlexUnit]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2010/06/07/flexunit-41-beta-1-now-available/</guid>
		<description><![CDATA[For months now the core FlexUnit team and contributors have been working diligently to move the next release of FlexUnit forward. The 4.0 release was a success but we always knew there were many optimization and enhancement still to come. &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2010/06/07/flexunit-41-beta-1-now-available/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[For months now the core FlexUnit team and contributors have been working diligently to move the next release of FlexUnit forward. The 4.0 release was a success but we always knew there were many optimization and enhancement still to come. Today, we are happy to announce some of those are available as the 4.1 public beta begins.

You can download the latest bits from the <a href="http://www.flexunit.org/?page_id=14" target="_blank">flexunit.org download site</a>.

Here are a few feature descriptions and bullet points of some of the new features in the FlexUnit 4.1 world.
<h2>Parameterized Testing</h2>
There are times when you need to repeat a test across a series of data points. Imagine a class that does a complex calculation based on input values. It is likely that you would want to test hundreds or thousands of different input values, checking each of their expected outputs to feel comfortable that this class was behaving properly. Or, perhaps you have a whole series of components which implement an interface and you wish to verify that setting the &#8216;x&#8217; property on each of those objects dispatches and expected event or updates a given property. These are both cases where Parameterized testing can simplify your life.
<span id="more-361"></span>
Parameterized testing in FlexUnit works by allowing you to specify arguments to be passed to a constructor (we call it JUnit style), or arguments which will be passed to a method (TestNG Style). Here is a quick sample of the approach:
<h3>Constructor (JUnit Style):</h3>
<code> [Parameters]
public static function data2():Array {
return [ [ 3, 6 ], [ 4, 8 ], [ 5, 10 ], [ 6, 12 ] ];
}</code>

<code>private var _input:int;
private var _expected:int;</code>

<code>public function TestParameterized( param1:int, param2:int ) {
_input = param1;
_expected = param2;
}</code>

<code>[Test]
public function doubleTest():void {
assertEquals(_expected, _input*2);
}
</code>
<h3>Method (TestNG Style):</h3>
<code> public static function dataThree():Array {
return [ [ 0, 1, 1 ], [ 1, 2, 3 ], [ 2, 4, 6 ] ];
}</code>

<code>[Test(dataProvider="dataThree")]
public function addTwoValuesTest( value1:int, value2:int, result:int ):void {
  assertEquals( value1 + value2, result );
}
</code>

Parameters are defined by static properties containing arrays of arrays. The framework iterates through the array, calling your methods with the parameters of each inner array. Parameterized testing can be combined with the asynchronous testing for very complex testing.

At first glance, those of you familiar with theories might see a lot of similarities to parameterized testing; they also allow a developer to create methods and a constructor that accept parameters. A theory is different in how the data is defined and in the way a test fails. A theory is akin to a mathematical theory wherein any failure means the whole theory is bad. Further, theories are often reversible. For instance, a valid theory might entail testing a math class by first multiplying two numbers and then dividing the product by the first number. If your code is valid, you should get the second number back. Testing this across a potentially infinite number of values is the real of a theory.

Whereas theories see all of the datapoints as input to a single test, which passes or fails as a whole, parameterized testing expands your set of parameters to individual tests allowing you to understand which cases fail and succeed individually. Parameterized tests are more useful in cases where you have a fixed data set with known specific values which represent a valid outcome.
<h2>External Data for Parameterized Testing and Theories</h2>
Executing tests across large data sets necessarily involves maintaining that data. FlexUnit 4.1 allows the data for Theories and Parameterized tests to be loaded from an external source.

<code>
public static var dataRetriever1:IExternalDependencyLoader = new ParamDataHelper( "PurelyFakeExample.xml" );
[Parameters(loader="dataRetriever1")]
public static var someData:Array;
</code>

The IExternalDependencyLoader interface works with the Theory and Parameterized test runners to facilitate asynchronous loading of data points before testing begins.


<h2>Rules Implementation</h2>
When creating large suites of unit tests, you could find yourself duplicating complex setup code many times. Rules offer the ability to factor this code into a separate class and specify logic that will be invoked before or after each test method call, allowing you to alter how a method is called, perform additional setup or even examine and change the result of a test runner.

<code> [Rule]
public var rule1:IMethodRule = new SomeRule();
[Test]
public function test1():void {
}
</code>

This feature can be used to create new types of test runners through composition instead of inheritance, allowing more flexibility, less code to maintain and the ability to reuse the rule across many types of runners. The first application of this technology was the auto-creation and verification of Mocks for test cases, however, the next application is a Rule to inject dependencies into cases.
<h2>Directory Scanning and Test Loading</h2>
Using the FlexUnit Ant tasks, you can point FlexUnit at a directory, which it will recursively scan for tests, build a temporary suite and execute on your behalf, removing the need to maintain static lists of tests in many cases.

<code>&lt;flexunit workingDir=&quot;&#36;{bin.loc}&quot; toDir=&quot;&#36;{report.loc}&quot; <br/>
&nbsp;haltonfailure=&quot;false&quot; verbose=&quot;true&quot; localTrusted=&quot;true&quot;&gt; <br/>
&nbsp;&nbsp;&lt;testSource dir=&quot;&#36;{main.src.loc}&quot; /&gt; <br/>
&nbsp;&nbsp;&lt;testSource dir=&quot;&#36;{test.src.loc}&quot;&gt; <br/>
&nbsp;&nbsp;&nbsp;&lt;include name=&quot;**/*Test.as&quot; /&gt; <br/>
&nbsp;&nbsp;&lt;/testSource&gt; <br/>
&nbsp;&lt;library dir=&quot;${lib.loc}&quot; /&gt;<br/>
&lt;/flexunit&gt;</code>
<h2>Performance Improvements</h2>
FlexUnit 4.1 now executes FlexUnit 4.x style metadata tests approximately 60% faster than before. New logic that directly monitors the progress of tests throughout the Flash Player frame allows the framework to better utilize the available time, resulting in an additional significant performance boost. Collectively these improvements can halve the execution time on very large suites over previous versions.
<h2>UIImpersonator for AS or Flex</h2>
Flex developers have had the ability to use the UIImpersonator classes to allow components to interact with the display list since version 4.0. Version 4.1 extends that coverage and allows ActionScript only projects the same access. A new property on FlexUnitCore allows developers to indicate the visual display root of the application, thereby allowing this access.

<code> var core:FlexUnitCore = new FlexUnitCore();
core.visualDisplayRoot = this;
</code>
<h2>Asynchronous Functionality now Available in Parameterized Testing and Theories</h2>
The ability to test asynchronously is imperative in Flash, where operations are often broken across frames. FlexUnit Asynchronous methods are now available in Theories and Parameterized Tests.
<h2>Package level assertions</h2>
You may have noticed that throughout these examples, we have simply said

<span style="font-family: monospace;">assertTrue()</span> instead of <span style="font-family: monospace;">Assert.assertTrue()</span>

Package level assertions now exist for all assertion methods, minimizing typing and porting from previous versions of FlexUnit or Fluint.
<h2>Timing information during test run</h2>
Timing information is gathered internal to the framework during test run, allowing for more accurate measurements of test execution time.


Now, go download the latest bits from the <a href="http://www.flexunit.org/?page_id=14" target="_blank">flexunit.org download site</a> and give us some feedback.]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2010/06/07/flexunit-41-beta-1-now-available/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>VectorCollection</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2010/05/18/vectorcollection/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2010/05/18/vectorcollection/#comments</comments>
		<pubDate>Tue, 18 May 2010 09:05:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2010/05/18/vectorcollection/</guid>
		<description><![CDATA[First, let me say I am sorry. A year or so ago, I wrote these VectorCollection classes. They are not spectacular works of art, they are very basic implementations required to use Vector inside of Flex components which are looking &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2010/05/18/vectorcollection/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[First, let me say I am sorry. A year or so ago, I wrote these VectorCollection classes. They are not spectacular works of art, they are very basic implementations required to use Vector inside of Flex components which are looking for IList and ICollectionView for their dataProviders.

Vector has some performance advantages in some cases (for more details, <a href="http://blogs.digitalprimates.net/codeSlinger/index.cfm/2009/5/20/An-Which-Array-but-Loose-the-code">take a look here</a>.  ) but overall, the big advantage to me is type safety. I know what should be in the Vector and flash knows if I mess that up.

On the whole, these are simple implementations that don&#8217;t solve every problem I would love to solve if I had the Flash Player source and some time, but they will allow you to use Vectors more directly in Flex.  So, if you find them useful, then enjoy.

<code>private var source:Vector.&lt;uint&gt;;
source = new Vector.&lt;uint&gt;;</code>

<code>private var vc:VectorListCollection;
vc = new VectorListCollection( source );</code>

<code>var sort:Sort = new Sort();
var field:SortField = new SortField( null, false, false, true );
sort.fields = [field];
vc.sort = sort;
vc.refresh();</code>

<a href='http://173.236.48.58/~digit329/codeslinger/wp-content/uploads/2010/05/VectorImplementations.zip'>File Available Here</a>

Cheers,
Mike]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2010/05/18/vectorcollection/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>360&#124; Flex and WorldWare Ahoy</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2010/01/06/360-flex-and-worldware-ahoy/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2010/01/06/360-flex-and-worldware-ahoy/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 09:01:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[360Flex]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2010/01/06/360-flex-and-worldware-ahoy/</guid>
		<description><![CDATA[March is shaping up to be a busy month for speaking, and I am pretty happy about it. I have the opportunity to deliver two distinct talks on topics where I feel, let&#8217;s just say, a lot of passion. First &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2010/01/06/360-flex-and-worldware-ahoy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
March is shaping up to be a busy month for speaking, and I am pretty happy about it. I have the opportunity to deliver two distinct talks on topics where I feel, let&#8217;s just say, a lot of passion. 
</p>
<p>
First up in the <a href="http://www.360flex.com/">360|Flex Conference in San Jose on March 7th-10th</a>. Here I am delivering a talk about the Flex Framework and its relationship to the component development in the Flex 4 methodology. There will actually be quite a few Flex 4 talks (and even component talks) available at 360|Flex this year; however, I think this will come across differently. I intend on tearing apart the framework again along the lines of my <a href="http://www.slideshare.net/michael.labriola/dense-and-hot-360-flex" target="_blank">Dense and Hot presentation</a> a few years back. The intent of this presentation is less about what and more about why. I want you to know things like the order that nested components have their commitProperties called versus their measure when you leave.  More importantly though, I want you to walk away knowing that it&#8217;s because of priority queues and nest-levels. I want you to feel comfortable explaining it to that poor guy back at the office that couldn&#8217;t make it to San Jose for the conference. That guys deserves some love to. You want to help him, right? I digress. 
</p>
<p>
In either case, I hope you can make it out to <a href="http://360flex-MichaelM.eventbrite.com">360|Flex</a>. It is always a good event. It is chocked full of great content and I don&#8217;t know that there is a better value in the Flex conference space. If you want to be extra-nice to me, you can <a href="http://360flex-MichaelM.eventbrite.com">register with this link</a>. Apparently if enough people register that way, John Wilker is going to carry me from place to place in some type of litter. All said though, try to make it if you can. Even if I wasn&#8217;t speaking, I would still be there learning from a great community willing to spread a lot of knowledge.
</p>
<p>
Right on the heels of 360 is the <a href="http://www.worldwareconference.com/">WorldWare conference in Santa Clara on March 16th-18th</a>. WorldWare is a conference dedicated to those developing applications for an international market. I will be doing a pre-conference workshop on the benefits of using the Flex Framework, with all of its UI swapping, layout object goodness, to the benefit of those wishing to write an i18n application in a reasonable amount of time and with a reasonable expectation of maintaining it (without sleeping at the office for the rest of their lives). This year&#8217;s theme at WorldWare is the ROI of Software Internationalization and I am honored to even be considered near the profound list of speakers. If your application or company is targeting the international world this is the place to be in March.
</p>
<p>
Hope to see you at one (or both )of these events,<br/>
Cheers,<br/>
Labriola<br/>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2010/01/06/360-flex-and-worldware-ahoy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Food for thought, using the Flex framework for dependency injection</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2009/12/28/food-for-thought-using-the-flex-framework-for-dependency-injection/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2009/12/28/food-for-thought-using-the-flex-framework-for-dependency-injection/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 15:12:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2009/12/28/food-for-thought-using-the-flex-framework-for-dependency-injection/</guid>
		<description><![CDATA[Dependency injection with Flex UI components can be tricky business. Not just doing it, there are a lot of strategies for that, but to do it without causing performance degradation and unnecessary work on the part of the framework and &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2009/12/28/food-for-thought-using-the-flex-framework-for-dependency-injection/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
Dependency injection with Flex UI components can be tricky business. Not just doing it, there are a lot of strategies for that, but to do it without causing performance degradation and unnecessary work on the part of the framework and ultimately flash player. To understand why, we need to discuss a bit about the whole component life cycle.
</p>
<p>
When a component is first instantiated, its constructor is executed and any local variables that might have been declared with initial values are set, etc., but the most important stuff&#8230; the stuff that makes a component a Flex component hasn&#8217;t happened yet and it won&#8217;t anytime soon. Properly written Flex components do the balance of their work after they are added to the display list. Back when I first started yapping about this stuff most of these life cycle methods weren&#8217;t well known, but today there are a lot of great resources on them, so I am just going to stick to the basics.
</p>
<p>
The methods I care about are createChildren, measure, commitProperties and updateDisplayList. Each of these methods is called by the Flex framework after the component is on the display list. With the exception of createChildren, you can almost think of these methods as being scheduled. They get called by the framework, at an appropriate time for optimal Flash player performance, if the component itself or some outside force deems it necessary.
</p>
<p>
To take advantage of this scheduling and to ensure you don&#8217;t have timing issues, a properly architected Flex component waits to create any static visual children until the createChildren method is called. It waits to make visual changes to the component until the updateDisplayList method. When a property is changed on the component that could affect one of the components children, i.e. the textinput inside of a datefield, the component saves off this change and applies it when commitProperties is called. Finally, the component aggregates information about its size and reports it (but never, ever changes it) during the measure method.
</p>
<p>
The reason I mention all of these things is that there is a fair amount of work that starts happening the moment the component is added to the display list. From that point on, all of these methods are called and changes to the component, especially those involving the amount of space it takes on the screen, can cause major amounts of rework. (If I change the size of a button in the middle of the page, I may need to size and layout the whole page again). You would never know this from the Adobe docs, but the creationComplete event is likely the worst place you can do many things and that is for this same reason. Everything is sized, positioned and ready to do&#8230; then you cause it all to change again.
</p>
<span id="more-63"></span>
<p>
That means that, to perform optimally, I really should set all of the properties and make all of the changes I can to a component before it is on the display list. After I do, every property change that happens can have a much bigger impact. This all gets even worse once data binding figures into the mix. Now changes to public properties of my component may very well end up causing other components to redo this same work and lay out their interface again. It can all get bad, and quickly.
</p>
<p>
Okay, a bit more info. When you declare a bunch of components in MXML, the Flex precompiler actually creates an array of something called component descriptors. Component descriptors basically indicate the class you wanted to build (e.g. VBox), any properties or styles you want set on the VBox (e.g. width, backgroundColor) and then it holds an array of the descriptors for any children of the VBox. So, basically, your MXML becomes a big set of arrays of descriptors. The interesting words I said above are &#8216;properties and styles&#8217;. You see, Flex already injects properties and styles into new instance during the creation process. In fact, if you look at the code for Container, you will see that it creates a new instance of whatever class you need (e.g. VBox) and then loops through all of the properties and sets them on the component. This all happens, very wisely, before the component is added to the display list and before any bindings on the child are initialized and executed. All that means that the way the components are created by Flex allows you to inject properties at runtime but do it in a way that does not cause unnecessary refreshes of the display, resizing or other such malicious actions.
</p>
<p>
Wouldn&#8217;t it be nice if you could tap into that code? Well, you can of course, because this is Flex and with enough desire you can basically do anything. That doesn&#8217;t mean, of course, that our good friends at Adobe couldn&#8217;t make this a whole lot easier if methods that can be overridden weren&#8217;t touching properties that can&#8217;t be&#8230; but that is another issue for another time.
</p>
<p>
In this example I am just overriding the methods of a VBox, but you could choose to extend every container, monkey path Flex, or even recompile the framework should you want this functionality to be part of ever container. Oh, before I even begin, let me just clarify this. I am not showing you a dependency injection framework or even a complete solution; I am showing you a concept. It does work as I have used this inside of my own framework code for the last several years, but the concept is the important part so that&#8217;s what I wanted to share.
</p>
<p>
Okay, first things first, Container has a method named createComponentForDescriptor. This gets called for every single child of the Container when it is time to build that component. So, we are going to override this method. Why? Well, several reasons. We are going to make a hook to modify the component descriptor before it gets created. Perhaps we will also add something in here which decides if the component should even be created at all.
</p>
<code>
override public function createComponentFromDescriptor(
	descriptor:ComponentDescriptor,
	recurse:Boolean):IFlexDisplayObject {

	var uiCompDesc:UIComponentDescriptor = descriptor as UIComponentDescriptor;

	var permission:String = securityManager.getPermissionsForDescriptor( uiCompDesc );
	
	if ( permission == SecurityManager.NOT_ALLOWED ) {
		return null;
	}
	
	var newDescriptor:UIComponentDescriptor = securityManager.modifyDescriptor( uiCompDesc, permission ); 
	newDescriptor = diManager.modifyDescriptor(newDescriptor ); 
	
	return super.createComponentFromDescriptor( newDescriptor, recurse );			
}
</code>
<p>
Alright, what in the world is going on in this code. Let me explain a bit. When this method is called, it is passed a descriptor that it needs to build. So, first thing we are doing is calling some fictitious security manager which is going to let us know if we can build the thing at all. How does it figure that out? That&#8217;s not up to me. Point is that you have a hook where you can ask some other object if you are allowed to build this new component. If you don&#8217;t understand why you would want to do that, no worries, it just means you aren&#8217;t writing apps that need that granular control, however, trust me, there are plenty of apps which need this. If you aren&#8217;t allowed to build it, you simply return a null. Flex happily goes onto the next component never looking back. In this way, entire branches of components can be created or not. 
</p>
<p>
Next thing that happens is that we pass this component descriptor to a method on our fictitious security manager and ask it to modify the descriptor as needed. What does this mean? Again, it&#8217;s a hook for your use. Imagine a scenario where you are asked to render a textinput. If the user has permission, you do so. If they don&#8217;t have permission to edit it, you (at runtime) decide to create a Label instead. This is all done without changing your MXML code.
</p>
<p>
Last thing we do is pass this modified descriptor to our fictitious dependency injection manager. This manager can use things like introspection, lookup or whatever else you might imagine to further modify this descriptor adding new values, removing old ones or doing something I haven&#8217;t imagined to the descriptor.
</p>
<p>
At the end of the method, we simply call our super class and pass along the modified descriptor. This causes Flex to go and execute the code which creates the class, injects the properties and adds it to the display list. So, we get the benefit of runtime modification of the components without the performance overhead of doing it once they are on the display list. If you care about such things, this is pretty cool. If you don&#8217;t, I won&#8217;t hold it against you.
</p>
<p>
Now you can do many more things to make this cleaner. Perhaps hide the container if no children are created so it is cleaner on the screen. Perhaps there are other managers or objects which should get a turn messing with the descriptor. Point is that this is a different way of looking at injecting properties by using the code that already existing in the framework to do this, rather than existing completely on the outside. Before anyone chimes in, yes, this is a Flex only solution.. and, as I already mentioned, it isn&#8217;t a solution, but an idea I wanted to share. 
</p>
<p>
Final thing, with just the tiniest modifications to the Flex framework, Adobe could provide us the ability to specify things like that DI manager at runtime. Then this could be done generically enough that we wouldn&#8217;t be recompiling, monkey patching or maintaining a dozen overridden containers. Food for thought.
</p>
<br/>
Labriola
<br/>]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2009/12/28/food-for-thought-using-the-flex-framework-for-dependency-injection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>$10 to advance your career</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2009/10/23/10-to-advance-your-career/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2009/10/23/10-to-advance-your-career/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 05:10:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2009/10/23/10-to-advance-your-career/</guid>
		<description><![CDATA[If you are in the midwest this weekend, you should really, really consider dropping by BFusion &#038; BFlex in Bloomington, Indiana. It is a bring your own laptop event full of hands-on tracks conducted by speakers from around the globe &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2009/10/23/10-to-advance-your-career/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
If you are in the midwest this weekend, you should really, really consider dropping by <a href="http://bflex.info/">BFusion &#038; BFlex in Bloomington, Indiana</a>. It is a bring your own laptop event full of hands-on tracks conducted by speakers from around the globe combined with optional full-day training sessions. The schedule is packed so full of content on Flex and ColdFusion topics that your only regret will be the inability to attend twice.
</p><p>
Here is a smathering of sessions from the Flex track (and remember, there is also a full day of fusion content too )
</p>
<ul>
<li>Hooking up Flex and ColdFusion. An introduction to CFAAS
<li>Integrating BlazeDS and ColdFusion
<li>New Flash Builder 4 WSDL and HTTP Connectors
<li>Drag and Drop Image Manager with Flex &#038; AIR
<li>Practical Cairngorm for Adobe Flex Applications
<li>Creating Your First HTML-Based Application for Adobe AIR with Dreamweaver CS4
<li>Building Flex Apps with Swiz: Simple, fast, flexible, powerful.
<li>Spark Components for Flex 4
<li>Component Development using the Flex 4 Model
<li>Using Merapi to tap into native code in your Flex application
<li>Flex Component Development from Scratch
<li>90 Minutes + Flixel = 1 Game
<li>Creating Applications for the Flash Platform
<li>Flex Intro for Developers
<li>Introduction to Flash Catalyst
</ul>
<p>
I am not sure how the folks at BFlex manage to provide this for a $10 price tag, but if you are close enough to even consider going to this event, it would be a mistake to miss it.
</p>
Hope to see you there,<br/>
Labriola
<br/>]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2009/10/23/10-to-advance-your-career/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexUnit in Flash Builder Bugs plus TDD</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2009/09/13/flexunit-in-flash-builder-bugs-plus-tdd/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2009/09/13/flexunit-in-flash-builder-bugs-plus-tdd/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 15:09:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[360Flex]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[FlexUnit]]></category>
		<category><![CDATA[Max 2009]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2009/09/13/flexunit-in-flash-builder-bugs-plus-tdd/</guid>
		<description><![CDATA[I just finished my presentation materials for my Test-driven development session at Adobe Max, and I am pretty excited how it turned out. It is a 90-minute BYOL (Bring your own laptop) lab, which is always challenging. Each person showing &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2009/09/13/flexunit-in-flash-builder-bugs-plus-tdd/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
I just finished my presentation materials for my Test-driven development session at <a href="http://max.adobe.com/">Adobe Max</a>, and I am pretty excited how it turned out. It is a 90-minute BYOL (Bring your own laptop) lab, which is always challenging. Each person showing up with a diverse setup and (hopefully) our files installed. 
</p><p>
So, if you are planning to head to Max, and you are interested in TDD, try to attend. I think it will be well worth the effort.
</p><p>
That said, there will also be two sessions at the <a href="http://www.360flex.com/">360|Flex Max unconference</a> where we will be reviewing the <a href="http://opensource.adobe.com/wiki/display/flexunit/FlexUnit">FlexUnit 4 framework</a> from the inside out. The goal here is
to provide initial context for those interested in becoming committers on the project. FlexUnit 4 is a highly functional testing framework, but it is also complex. Until we have the chance to document every corner, this might be your best chance to learn the ins and outs of it.
</p><p>
Finally, working on this session has given me the opportunity to work with the FlexUnit plugin in Flash Builder. I must say I am very pleased with how this is evolving. Nonetheless, there are a few enhancements I would still like. If you are of a like mind, read through the bugs and cast your vote.
</p><p>
<ul>
<li><a href="https://bugs.adobe.com/jira/browse/FB-22832">Auto Refresh of the flex unit compiler application when deleting a test case or (minimally) re-running the wizard</a> <br/> Right now deleting a test case causes a manualy compilation error that needs resolution. I think this could be more elegant.
<li><a href="https://bugs.adobe.com/jira/browse/FB-22830">Uncheck Create Constructor by default in FU4 test case</a> <br/> Just a minor inconvenience. You generally don&#8217;t need constructors in FU4 test cases, so you uncheck a checkbox&#8230; often
<li><a href="https://bugs.adobe.com/jira/browse/FB-22831">Generate Before/After in place of setup/teardown for FU4 testcases</a><br/>Right now the wizards don&#8217;t know how to generate the FU4 equivalent of setUp() and tearDown(). Not a big deal, but I think it&#8217;s low-hanging fruit.
<li><a href="https://bugs.adobe.com/jira/browse/FB-22834">Remember Last Selected Type when creating test cases from the wizard</a><br/>Just a minor inconvenience. You always need to re-select the radio button when using the wizard with FU4.
</ul>
</p>
If you agree, vote away.

Hope to see you at Max,<br/>
Mike]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2009/09/13/flexunit-in-flash-builder-bugs-plus-tdd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlexUnit 4 and Flex 4 presentations galore</title>
		<link>http://www.digitalprimates.net/author/codeslinger/2009/09/03/flexunit-4-and-flex-4-presentations-galore/</link>
		<comments>http://www.digitalprimates.net/author/codeslinger/2009/09/03/flexunit-4-and-flex-4-presentations-galore/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:09:00 +0000</pubDate>
		<dc:creator>codeslinger</dc:creator>
				<category><![CDATA[360Flex]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[DP News]]></category>
		<category><![CDATA[flexcamp]]></category>
		<category><![CDATA[FlexUnit]]></category>
		<category><![CDATA[Max 2009]]></category>

		<guid isPermaLink="false">http://test.digitalprimates.net/2009/09/03/flexunit-4-and-flex-4-presentations-galore/</guid>
		<description><![CDATA[So after a very welcomed summer lull in travel, I am gearing up for the fall speaking season. A good portion of my time this fall will be spent discussing, encouraging the use of, and getting Feedback on the FlexUnit &#8230; <a href="http://www.digitalprimates.net/author/codeslinger/2009/09/03/flexunit-4-and-flex-4-presentations-galore/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
So after a very welcomed summer lull in travel, I am gearing up for the fall speaking season. A good portion of my time this fall will be spent discussing, encouraging the use of, and getting Feedback on the FlexUnit 4 project. The rest will be spent teaching about the early architecture and internals of the future Flex 4 product. 
</p><p>
If you have tried either of these and want to discuss, or if you haven&#8217;t had the time and want to learn more first, please come and support one of the following great events where I will be presenting.
</p><p>
<b>September 5th, Rimini, Italy</b> at <a href="http://www.flashcamp.it/">Flash Camp on the Beach</a>
<ul>
Testing with Flex and Flash Builder</ul>
<b>October 5th &#8211; 7th, Los Angeles, CA</b> at <nobr><a href="http://max.adobe.com/">Adobe Max, Los Angeles, CA</a><br/></nobr>
<ul>
5th &#8211; Test Driven Development with Flash Builder<br/>
5th &#8211; Creating Custom Components in Flex 4<br/>
5th &#8211; Book Signing and Meet the Authors Event<br/>
<br/>
6th &#8211; Creating Custom Components in Flex 4<br/>
6th &#8211; Battle of the Flex Frameworks Panel<br/>
<br/>
7th &#8211; Creating Custom Components in Flex 4- Twice<br/>
<br/>
Also, in the next couple of days we will be announcing the details of a special event on the 6th and 7th in coordination with the <a href="http://www.360flex.com/">360|Max unconference</a>  for individuals interested in becoming contributors to the FlexUnit 4 project.
</ul>
<b>October 15th and 16th in Omaha, NE</b> at <nobr><a href="http://www.heartlanddc.com/omaha/default.aspx">the Heartland Developers Conference</a></nobr>
<ul>
15th &#8211; From Concept to Concrete: Programming a Designer&#8217;s Vision <br/>
16th &#8211; Reanimating Dead Data with Flex <br/>
</ul>
<b>October 17th and 18th in Raleigh, North Carolina</b> at <a href="http://www.cfinnc.com/">CFinNC</a>
<ul>
Next Generation Testing
</ul>
</p><p>
I hope you have the opportunity to participate and engage with the Flex community at some of these community events. 
</p><p>
Cheers,<br/>
Mike <br/>
<br/>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalprimates.net/author/codeslinger/2009/09/03/flexunit-4-and-flex-4-presentations-galore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

