<?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>Turing tarpit &#187; logging</title>
	<atom:link href="http://www.turingtarpit.com/tag/logging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.turingtarpit.com</link>
	<description>Where everything is possible but nothing of interest is easy –Alan Perlis</description>
	<lastBuildDate>Thu, 11 Mar 2010 02:01:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PureMVC Console &#8211; Shines a light inside the MVC triad</title>
		<link>http://www.turingtarpit.com/2009/03/puremvc-console-shines-a-light-inside-the-mvc-triad/</link>
		<comments>http://www.turingtarpit.com/2009/03/puremvc-console-shines-a-light-inside-the-mvc-triad/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 22:31:38 +0000</pubDate>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.turingtarpit.com/?p=26</guid>
		<description><![CDATA[I was checking the PureMVC website today and came across PureMVC Console developed by the good folks at Kap Lab. This is an absolutely invaluable tool to figure out in real-time what is going on inside the Flex PureMVC framework in a running application.]]></description>
			<content:encoded><![CDATA[<p>I was checking the <a href="http://puremvc.org/">PureMVC</a> website today and came across <a href="http://lab.kapit.fr/display/puremvcconsole/PureMVC+Console">PureMVC Console</a> developed by the good folks at <a href="http://lab.kapit.fr/display/kaplabhome/Home">Kap Lab</a>. This is an absolutely invaluable tool to figure out in real-time what is going on inside the Flex PureMVC framework in a running application. PureMVC is quite lightweight and is very good at keeping things hidden under the hood. However, during development it is essential to get a snapshot of application state and the sequence of notifications. This is exactly what PureMVC Console does. It provides you with a flashlight to peer into your Notifications, Commands, Mediators and Proxies and track notifications and application flow in response to user gestures and other events.</p>
<div>
<p>For example, if you need to know the state of your <em>value objects</em> at any point, just click on the <em>Proxies</em>tab and select the proxy.</p>
<p><a title="Inspecting the value objects inside the proxies" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/vos.jpg"><img class="alignnone size-medium wp-image-28" title="Inspecting the value objects inside the proxies" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/vos-300x257.jpg" alt="Inspecting the value objects inside the proxies" width="300" height="257" /></a></p>
<p>If you want to check the sequence of actions taking place in your application from startup, just click on the PureMVC flow tab. This is very useful for debugging as it provides a record of the command invocation sequence and will help answer questions like &#8220;why did this command execute before this other one?&#8221;</p>
<p><a title="Inspecting the flow of the application" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/flow1.jpg"><img class="alignnone size-medium wp-image-32" title="Inspecting the flow of the application" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/flow1-300x259.jpg" alt="Inspecting the flow of the application" width="300" height="259" /></a></p>
<p>I am a big fan of the <a href="http://osflash.org/xray">Xray logger</a> developed for Flash AS2 and had to try out this console right away as this is the first console with similar utility for AS3, I integrated the console into the <a href="http://trac.puremvc.org/Demo_AS3_Flex_EmployeeAdmin">Employee Admin demo</a> (developed by Cliff Hall).</p>
<a name="wptoc_0_0_0"></a><h4>Employee Admin Demo with integrated Console</h4>
<p>Click on the button below to open the Employee Admin demo. Make sure that you hit <strong>Ctrl+Alt+F6</strong> to open the console ( <strong>Alt</strong> = <strong>Option</strong> in OSX ).</p>
<p><a href="http://www.turingtarpit.com/wp-content/uploads/2009/03/employeeadmin.swf" target="_blank"><img class="alignnone size-full wp-image-39" title="click_to_open_btn" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/click_to_open_btn.jpg" alt="click_to_open_btn" width="101" height="34" /></a></p>
<a name="wptoc_0_0_1"></a><h4>Integrating the console into the <em>Employee Admin</em> Demo</h4>
<p>The console is very easy to integrate into a new or existing app &#8211; just follow the <a href="http://lab.kapit.fr/display/puremvcconsole/Integration+Guide">integration guide</a>. The ease of integration is a huge plus as it is simply injected before the application is invoked.</p>
<a name="wptoc_1_1_0"></a><h5>1. Add the PureMVC Console SWC into your library</h5>
<p>First drag-and-drop the PureMVC Console swc file into the libs folder in your Flex project. There is a different swc if you are using the multi-core version of PureMVC.</p>
<p><img class="alignnone size-full wp-image-50" title="project_files" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/project_files.jpg" alt="project_files" width="226" height="199" /></p>
<a name="wptoc_1_1_1"></a><h5>2. Add the console component into your application</h5>
<p>For an MXML app, you need to add an additional  <code>xmlns:kapit="fr.kapit.*"</code> name space attribute to the  <code>&lt;mx:Application&gt;</code> tag and then add the  <code>&lt;kapit:PureMVCConsole/&gt;</code> component before the closing <code>&lt;/mx:Application&gt;</code> tag (see <a href="http://lab.kapit.fr/display/puremvcconsole/Integration+Guide">integration guide</a>). I added this to the <code>EmployeeAdmin.mxml</code> file which is the default application for the project.</p>
<a name="wptoc_1_1_2"></a><h5>3. Add a new SwitchFacade parent class for you application facade</h5>
<p>The next step is to create a new <code>SwitchFacade</code> class and modify your application facade so that it inherits from <code>SwitchFacade</code> ( instead of the PureMVC <code>Facade</code> class ). The <code>SwitchFacade</code> class is the same for all apps and can be copied and pasted from the <a href="http://lab.kapit.fr/display/puremvcconsole/Integration+Guide">integration guide</a>. Make sure you create the <code>SwitchFacade</code> class in the same location in the folder hierarchy where you current application facade class resides. You can right click on the enclosing folder (employeeadmin in my case) and create <strong>New &gt; ActionScript Class</strong> and type in <code>SwitchFacade</code> for the class name. Now copy and paste the code.</p>
<p><img class="alignnone size-full wp-image-54" title="project_files2" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/project_files2.jpg" alt="project_files2" width="345" height="415" /></p>
<p>Injecting the  <code>SwitchFacade</code> class allows you to control the integration of the console using compiler directives as opposed to changing code when it comes time to ship the application. <code>SwitchFacade</code> extends the PureMVC <code>Facade</code> class if the <em>CONFIG::release</em> directive is set. Conversely, if the <em>CONFIG::debug</em> directive is set ( and <em>CONFIG::release</em> is unset), <code>SwitchFacade</code> extends  <code>DebugFacade</code> that has all the debug stuff required by the console.</p>
<a name="wptoc_1_1_3"></a><h5>4. Set the compiler directives</h5>
<p>To control which facade gets extended you need to add the <em>CONFIG::release</em> and <em>CONFIG::debug</em> directives in the compiler options. Right click on the <em>Project folder</em> and choose <em>properties</em> from the contextual menu. Now click on <em>Flex Compiler</em> option to add the additional compiler directives in the <em>Additional Compiler Arguments</em> field.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">-define=CONFIG::release,false -define=CONFIG::debug,true</pre></div></div>

<p><a title="Setting compiler options" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/compiler_options.jpg"><img class="alignnone size-medium wp-image-57" title="compiler_options" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/compiler_options-300x240.jpg" alt="compiler_options" width="300" height="240" /></a></p>
<p><a title="Setting compiler options" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/compiler_options.jpg"></a><br />
Reset the directives for the release version.</p>
<p><strong>Recap of cool features:</strong></p>
<ul>
<li>Very easy to integrate into a new or existing app.</li>
<li>Works with the standard version of Flash ( does not need the debugger version ).</li>
<li>Integration is controlled by using compiler options ( just change a compiler option for the release version ).</li>
</ul>
<p>Simple to integrate and keeps out of the way of you doing the job of coding and debugging &#8211; excellent!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.turingtarpit.com/2009/03/puremvc-console-shines-a-light-inside-the-mvc-triad/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
