<?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>rialvalue.com &#187; flexunit</title>
	<atom:link href="http://www.rialvalue.com/blog/category/flexunit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rialvalue.com/blog</link>
	<description>No Flex No Fun</description>
	<lastBuildDate>Fri, 04 Feb 2011 08:09:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Documenting functions and named parameters</title>
		<link>http://www.rialvalue.com/blog/2011/02/04/documenting-functions-and-named-parameters/</link>
		<comments>http://www.rialvalue.com/blog/2011/02/04/documenting-functions-and-named-parameters/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 08:03:09 +0000</pubDate>
		<dc:creator>Xavi Beumala</dc:creator>
				<category><![CDATA[best practice]]></category>
		<category><![CDATA[best_practice]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[flexunit]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.rialvalue.com/blog/?p=299</guid>
		<description><![CDATA[Sometime ago someone asked me how I&#8217;d pass custom paramaters to event listeners. I don&#8217;t remember the exact use case neither who asked me but basically he was asking for something like:
mc.addEventListener&#40;MouseEvent.CLICK, myListener, &#34;myCustomParam&#34;, 2&#41;;
functoin myListener&#40;event: MouseEvent, custom :String, custom2 : int&#41; : void;
While the exact syntax above would not be possible, closures are in [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime ago someone asked me how I&#8217;d pass custom paramaters to event listeners. I don&#8217;t remember the exact use case neither who asked me but basically he was asking for something like:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:515px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> myListener<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;myCustomParam&quot;</span><span style="color: #000066; font-weight: bold;">,</span> 2<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
functoin myListener<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">,</span> custom <span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> custom2 <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>While the exact syntax above would not be possible, closures are in any case the way to go. I explained him how I&#8217;d do it and I forgot about the topic until today.</p>
<p>Today while waiting for a long compilation process to complete I&#8217;ve came up with an idea on how to improve code readability on cases similar to this. Here&#8217;s the cleaneast syntax I&#8217;ve came up with (ideas are more than welcome to improve it):</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:515px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span>myListener<span style="color: #000066; font-weight: bold;">,</span> withParameters<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;myCustomParam&quot;</span><span style="color: #000066; font-weight: bold;">,</span> 2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>Does it look too verbose? I guess it will highly depend on the exact use case where this is used. But under some circumstances I think the readability can be substantially improved.</p>
<p><b>createListenerAdapterBasedOn</b> is a <a href="http://www.rialvalue.com/blog/2011/01/25/as3-package-level-functions-and-java-static-imports/">package level method</a>. I could have used a utility static method like FunctionUtils.createListenerAdapter. But instead I&#8217;ve used a package function because I can reduce the length of the Class + method name (or use the same number of characters to add verbosity and clarity). On the other hand it&#8217;s unlikely that this utility class would have more methods.</p>
<h2>Documenting functions</h2>
<p>This is a concept I&#8217;ve never read about or used before, but I think I&#8217;ll start using in different places. <i>withParameters</i> method is a completely dummy method that simply returns the parameters it gets but <b>giving them a semantic and contextual meaning</b>. The solely purpose of this method is to improve the readability by converting the method invocation in a Fluent API that can be read as natural language. The method is simply documenting the usage of the call. Putting this together with the <a href="http://www.rialvalue.com/blog/2010/03/30/some-thoughts-on-method-parameters/">Builder pattern and named parameters I discussed a while ago</a> it gives us an incredible weapon to create self-documented code that doesn&#8217;t need most-of-the-times useless, needless and confusing ASDoc or inline comments.</p>
<p>If necessary when you have a method accepting several parameters of the same type and that can be confusing to read you could used Documenting functions to create kind of named-parameters:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:515px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">myMethod<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;John&quot;</span><span style="color: #66cc66;">&#41;</span>, surname<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Green&quot;</span><span style="color: #66cc66;">&#41;</span>, age<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">33</span><span style="color: #66cc66;">&#41;</span>, weight<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">70</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></div>
<p>Here are the details of the implementation in case you are interested in seeing the internal details and some of the tests.</p>
<h3>createListenerAdapterBasedOn.as</h3>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:515px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> com<span style="color: #000066; font-weight: bold;">.</span>rialvalue<span style="color: #000066; font-weight: bold;">.</span>utils<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span>callback<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">...</span> args<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">...</span> rest<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:*</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>args<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> == 1<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> callback<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">apply</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> rest<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">concat</span><span style="color: #000000;">&#40;</span>args<span style="color: #000000;">&#91;</span>0<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> callback<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">apply</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> rest<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">concat</span><span style="color: #000000;">&#40;</span>args<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<h3>withParameters.as</h3>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:515px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> com<span style="color: #000066; font-weight: bold;">.</span>rialvalue<span style="color: #000066; font-weight: bold;">.</span>utils<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> withParameters<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">...</span> args<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> args<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<h3>createListenerAdapterBasedOnTest.as</h3>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:515px;height:330px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> com<span style="color: #000066; font-weight: bold;">.</span>rialvalue<span style="color: #000066; font-weight: bold;">.</span>utils<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=ieventdispatcher%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:ieventdispatcher.html"><span style="color: #004993;">IEventDispatcher</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> flashx<span style="color: #000066; font-weight: bold;">.</span>textLayout<span style="color: #000066; font-weight: bold;">.</span>debug<span style="color: #000066; font-weight: bold;">.</span>assert<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>flexunit<span style="color: #000066; font-weight: bold;">.</span>assertThat<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>hamcrest<span style="color: #000066; font-weight: bold;">.</span>object<span style="color: #000066; font-weight: bold;">.</span>equalTo<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ListenerUtilsTest<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> static const ORIGINAL_PARAMETER<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;originalParameter&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> static const FIRST_PARAM<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;firstParam&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> static const SECOND_PARAM<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;secondParam&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createCallbackAdapterWithNoParameters<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> callbackAdapter<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a> = createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callbackAdapter<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createCallbackAdapterWithIndividualParameter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> callbackAdapter<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a> = createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> p1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>FIRST_PARAM<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span>p1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span> withParameters<span style="color: #000000;">&#40;</span>FIRST_PARAM<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callbackAdapter<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createCallbackAdapterWithIndividualParameterNoFluent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> callbackAdapter<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a> = createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> p1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>FIRST_PARAM<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span>p1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span> FIRST_PARAM<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callbackAdapter<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createCallbackAdapterWithIndividualParameters<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> callbackAdapter<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a> = createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> p1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> p2<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>FIRST_PARAM<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span>p1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>SECOND_PARAM<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span>p2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span> withParameters<span style="color: #000000;">&#40;</span>FIRST_PARAM<span style="color: #000066; font-weight: bold;">,</span> SECOND_PARAM<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callbackAdapter<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createCallbackAdapterWithIndividualParametersNoFluent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> callbackAdapter<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html"><span style="color: #004993;">Function</span></a> = createListenerAdapterBasedOn<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> p1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">,</span> p2<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>FIRST_PARAM<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span>p1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #000000;">&#40;</span>SECOND_PARAM<span style="color: #000066; font-weight: bold;">,</span> equalTo<span style="color: #000000;">&#40;</span>p2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span> FIRST_PARAM<span style="color: #000066; font-weight: bold;">,</span> SECOND_PARAM<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callbackAdapter<span style="color: #000000;">&#40;</span>ORIGINAL_PARAMETER<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.rialvalue.com/blog/2011/02/04/documenting-functions-and-named-parameters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Assert( Gumbo )</title>
		<link>http://www.rialvalue.com/blog/2009/06/09/assert-gumbo/</link>
		<comments>http://www.rialvalue.com/blog/2009/06/09/assert-gumbo/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 20:23:47 +0000</pubDate>
		<dc:creator>Xavi Beumala</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[flexunit]]></category>
		<category><![CDATA[functional testing]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.rialvalue.com/blog/?p=23</guid>
		<description><![CDATA[Here are the slides I used during my presentation around testing, FlexUnit4 and RIATest.











 
]]></description>
			<content:encoded><![CDATA[<p>Here are the slides I used during my presentation around testing, FlexUnit4 and RIATest.</p>
<p>
<object width="525" height="400">
<param name="movie" value="https://share.acrobat.com/adc/flex/mpt.swf" />
<param name="quality" value="high" />
<param name="wmode" value="window" />
<param name="menu" value="false" />
<param name="bgcolor" value="#FFFFFF" />
<param name="allowFullScreen" value="true"></param>
<param name="flashvars" value="ext=pdf&docId=fefe9a1b-c7c1-4c62-9563-7fc215adefd3&lang=en_US"></param>
<embed type="application/x-shockwave-flash" width="525" height="400" src="https://share.acrobat.com/adc/flex/mpt.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" flashvars="ext=pdf&docId=fefe9a1b-c7c1-4c62-9563-7fc215adefd3&lang=en_US" ></embed>
</object>
 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rialvalue.com/blog/2009/06/09/assert-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

