<?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>Blog &#187; Codes</title>
	<atom:link href="http://blog.joaopescada.com/category/codes/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joaopescada.com</link>
	<description>thoughts, codes and visuals. and some random stuff.</description>
	<lastBuildDate>Sat, 27 Feb 2010 22:56:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>AS3 on PureMVC. Round One.</title>
		<link>http://blog.joaopescada.com/article/as3-on-puremvc-round-one/</link>
		<comments>http://blog.joaopescada.com/article/as3-on-puremvc-round-one/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 02:43:05 +0000</pubDate>
		<dc:creator>João Pescada</dc:creator>
				<category><![CDATA[Codes]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[design-patterns]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[model-view-controller]]></category>
		<category><![CDATA[oop]]></category>

		<guid isPermaLink="false">http://blog.joaopescada.com/?p=36</guid>
		<description><![CDATA[As referenced in the title, this article is about coding Actionscript 3.0 in a Model-View-Controller design pattern, namely the PureMVC way. Problems don&#8217;t exist. Only opportunities for creating solutions. A few years back, when I started on web design / development, it was a one-man show. I then started working with other developers from time (...) <br /><a href="http://blog.joaopescada.com/article/as3-on-puremvc-round-one/">Read More <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.joaopescada.com/wp-content/uploads/2010/01/as3-on-puremvc1.jpg" alt="" title="Boxing gloves" width="540" height="200" class="alignnone size-full wp-image-228" /></p>
<p>As referenced in the title, this article is about coding <a href="http://en.wikipedia.org/wiki/ActionScript" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">Actionscript</a> 3.0 in a <a href="http://en.wikipedia.org/wiki/Model–view–controller" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">Model-View-Controller</a> <a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">design pattern</a>, namely the <a href="http://puremvc.org/" target="_blank">PureMVC</a> way.</p>
<h3>Problems don&#8217;t exist. Only opportunities for creating solutions.</h3>
<p>A few years back, when I started on web design / development, it was a one-man show. I then started working with other developers from time to time. Two years ago, I joined a team of Adobe Flash developers, and only then I realized how many routes a single coding task can take. We all have different approaches on coding and with this in mind, I felt the need to find a standardized way of developing Adobe Flash based websites / applications.</p>
<p><span id="more-36"></span>Last year, after a lot of online research on Actionscript frameworks, I found PureMVC to be the most stable, mature and — most importantly — well documented.</p>
<h3>Kicking the tyres.</h3>
<p>Before having other team members sharing my opinion, I had to try it myself and apply all the concept on a real project.</p>
<p>My first approach on this design pattern — by the time of publishing this article — is still to be available online. It&#8217;s nothing too fancy, but what&#8217;s on focus here, is the code holding the pieces together. It&#8217;s a structure built to support three websites with similar content for Casinos de Angola. Two websites are on an ongoing approval process, while the third is still to be designed.</p>
<h3>“If anything can go wrong, it will.”</h3>
<p>Having little to no experience using the <acronym title="Model-View-Controller">MVC</acronym> pattern, and a deadline to meet, it was a risky choice to make. But still, I opted to take this road. And so — validating the aforementioned <a href="http://en.wikipedia.org/wiki/Murphy's_law" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">Murphy&#8217;s Law</a> — I failed the initial deadline.</p>
<p>The development process took waaaaaay longer than I expected. Not because there was a lot to code, but because there was a lot to learn in order to get a solid ground to start building with the chosen architecture.<br />
A big learning curve of concepts before getting into any real coding is a bummer.</p>
<h3>Happier programming.</h3>
<p>What do you think about the idea? Sounds good, right? It feels even better!<br />
The framework enables a <a href="http://en.wikipedia.org/wiki/Loose_coupling" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">loose coupling</a> between resources allowing an easy development of really project independent components. Maybe this is geek / coder talk, but it feels a more Human-like communication between abstract project resources. Bare this in mind: the notifications are a bliss to work with!</p>
<p>Being an avid follower of the <a href="http://en.wikipedia.org/wiki/Don't_Repeat_Yourself" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">Don&#8217;t Repeat Yourself</a> principle and a <a href="http://en.wikipedia.org/wiki/Control_freak" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">control freak</a> for logical organization and standardization I chose to implement a <a href="http://en.wikipedia.org/wiki/Convention_over_Configuration" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">Convention Over Configuration</a> paradigm by specifying the website structure / layout in a single <a href="http://en.wikipedia.org/wiki/XML" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">XML</a> (Model) file.</p>
<p>As most developers, if I can avoid extra work, by automating processes, I do. Better yet: if I can avoid starting a new project from scratch, and just re-factor 10-15% code of a previous one, I SURE do. And that&#8217;s what happened. Having the website contents (Model/Proxies) automating the layout (View), only a few bits of the business logic (Mediators) had to be changed. Now THIS is (planned) <a href="http://en.wikipedia.org/wiki/Code_reuse" rel="Wikipedia" target="_blank" title="Open definition in Wikipedia">code reuse</a>!</p>
<h3>Wrapping up…</h3>
<p>“The concept of PureMVC may make the best of us shy away, but once you&#8217;ve got your head around the bare fundamentals, you&#8217;ll soon be flying your way around it.” — <a href="http://ahmednuaman.com/" target="_blank" title="Open Ahmed Nuaman's website">Ahmed Nuaman</a> said it on <a href="http://active.tutsplus.com/tutorials/workflow/understanding-the-puremvc-open-source-framework/" target="_blank" title="Open 'Understanding the PureMVC Open Source Framework' tutorial">the first tutorial on PureMVC I&#8217;ve read</a>, and I could not agree more (though I&#8217;m still learning the flying part).</p>
<p>I&#8217;m currently — at the time I started writing this article — finishing the development of two video players with similar functionalities, and everything is running smoother and faster. The first player took around 7 hours to complete. The second one? 45 minutes!</p>
<p>One of the biggest conclusions I found with this road I took was that allowing myself to fail, brought an enormous bandwagon of knowledge and rewarding experience. Only by trying harder and harder every now and then, and subsequently failing a lot of those times, you will broaden your comfort zone and therefore your horizons.</p>
<p>Maybe there&#8217;s an influence here from the <a href="http://www.offf.ws/oeiras/" target="_blank" title="Open OFFF Oeiras'09 website">OFFF&#8217;s 2009 edition</a> theme: “Fail Gracefully” and the “This isn&#8217;t flying, this is falling with style” quote from <a href="http://www.imdb.com/title/tt0114709/" target="_blank" title="Open Toy Story's page at IMDB website">Toy Story</a>.</p>
<h3>Want to learn more about AS3 on PureMVC?</h3>
<p>Follows a list of articles / tutorials / books I&#8217;ve read, that I think are important for anyone that would like to learn more on the subject:</p>
<ul>
<li><a href="http://active.tutsplus.com/tutorials/workflow/understanding-the-puremvc-open-source-framework/" target="_blank" title="Open tutorial">Understanding the PureMVC Open Source Framework</a> by <a href="http://ahmednuaman.com/" target="_blank" title="Open Ahmed Nuaman's website">Ahmed Nuaman</a></li>
<li><a href="http://puremvc.org/pages/docs/current/PureMVC_Implementation_Idioms_and_Best_Practices.pdf" target="_blank" title="Open PDF">PureMVC: Implementation Idioms and Best Practices</a> [PDF] by <a href="http://content.futurescale.com/" target="_blank" title="Open Cliff Hall's website">Cliff Hall</a></li>
<li><a href="http://lowpitch.com/blog/why-puremvc-and-scaling-the-learning-curve/" target="_blank" title="Open article">Discovering PureMVC, and scaling the learning curve</a> by <a href="http://lowpitch.com/" target="_blank" title="Open Toby Ashley's website">Toby Ashley</a></li>
<li><a href="http://hubflanger.com/building-a-flash-site-using-puremvc/" target="_blank" title="Open tutorial">Building a Flash site using PureMVC</a> by <a href="http://hubflanger.com/" target="_blank" title="Open Yee Peng Chia's website">Yee Peng Chia</a></li>
<li><a href="http://www.actionscriptdeveloper.co.uk/puremvc-tutorial-flex-puremvc-jabber-and-xiff-3-introduction/" target="_blank" title="Open tutorial">Puremvc Tutorial &#8211; Flex, Puremvc, Jabber and Xiff 3</a> by <a href="http://www.actionscriptdeveloper.co.uk/" target="_blank" title="Open Dave Keen's website">Dave Keen</a></li>
<li><a href="http://active.tutsplus.com/tutorials/video/creating-a-youtube-search-and-play-gadget-with-puremvc/" target="_blank" title="Open tutorial">Creating a YouTube Search and Play Gadget with PureMVC</a> by <a href="http://ahmednuaman.com/" target="_blank" title="Open Ahmed Nuaman's website">Ahmed Nuaman</a></li>
<li><a href="http://www.as3dp.com/2007/12/27/minimalist-mvc-example-using-the-puremvc-framework/" target="_blank" title="Open tutorial">Minimalist MVC example using the PureMVC Framework</a> by <a href="http://www.turingtarpit.com/" target="_blank" title="Open Chandima Cumaranatunge's website">Chandima Cumaranatunge</a></li>
<li><a href="http://www.amazon.co.uk/gp/product/0596528469?ie=UTF8&#038;tag=jopebl-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=0596528469" target="_blank" title="Open page at Amazon">ActionScript 3.0 Design Patterns: Object Oriented Programming Techniques</a> [Book] by <a href="http://www.sandlight.com/" target="_blank" title="Open William Sander's website">William Sander</a> and <a href="http://www.turingtarpit.com/" target="_blank" title="Open Chandima Cumaranatunge's website">Chandima Cumaranatunge</a></li>
</ul>
<p>I&#8217;ll be keeping this list updated with new articles / tutorials / books once I find and read them.</p>
<h3>Any feedback?</h3>
<p>Do you use PureMVC or have tried it? Like it? Hate it? Maybe another framework?<br />
I would love to hear your opinions and to know whether or not I should go for a &#8220;Round Two&#8221; article on the PureMVC subject.<br />
Your feedback will be much appreciated!</p>
<p>For updates on more articles like this, subscribe the <a href="http://feeds.feedburner.com/joaopescada" target="_blank" title="Subscribe the blog's RSS Feed">blog&#8217;s RSS Feed</a>.</p>
<p><em><a href="http://www.sxc.hu/photo/901669" title="Open photo at SXC.hu" rel="SXC" target="_blank">Photo</a> by <a href="http://www.sxc.hu/profile/vierdrie" title="Open user page at SXC.hu" rel="SXC" target="_blank">Jean Scheijen</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joaopescada.com/article/as3-on-puremvc-round-one/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
