<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rico on Flex &#187; PureMVC</title>
	<atom:link href="http://ricozuniga.com/category/puremvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://ricozuniga.com</link>
	<description>My thoughts on Adobe Flex, AIR, Flash, Actionscript, &#38; PureMVC.</description>
	<lastBuildDate>Tue, 01 Dec 2009 06:40:59 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ricozuniga.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9a142ae4432380a1620df63224a1f6a1?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rico on Flex &#187; PureMVC</title>
		<link>http://ricozuniga.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ricozuniga.com/osd.xml" title="Rico on Flex" />
	<atom:link rel='hub' href='http://ricozuniga.com/?pushpress=hub'/>
		<item>
		<title>PureMVC Program Flow Part 1 &#8211; The View</title>
		<link>http://ricozuniga.com/2008/07/26/puremvc-program-flow-part-1-the-view/</link>
		<comments>http://ricozuniga.com/2008/07/26/puremvc-program-flow-part-1-the-view/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 18:24:55 +0000</pubDate>
		<dc:creator>ricoz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://ricoonflex.wordpress.com/?p=73</guid>
		<description><![CDATA[It has been a great experience so far working with PureMVC. There was quite a huge barrier for entry due to its steeper learning curve but after gaining enough practical knowledge of the framework, my team was able to quickly implement most of the UI related logic and some business logic requirements of our project [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ricozuniga.com&blog=908089&post=73&subd=ricoonflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>It has been a great experience so far working with <a title="PureMVC" href="http://www.puremvc.org/" target="_blank">PureMVC</a>. There was quite a huge barrier for entry due to its steeper learning curve but after gaining enough practical knowledge of the framework, my team was able to quickly implement most of the UI related logic and some business logic requirements of our project while maintaining integrity of the code. Now the only thing left to do is to connect the application to the data in the backend.</p>
<p>In this post, I would like to discuss the general flow of an application built on top of PureMVC. This is how we understood the framework and it&#8217;s the approach we used for our application. The flow is actually pretty simple and straightforward, even obvious. We used the <a title="PureMVC Multicore" href="http://trac.puremvc.org/PureMVC_AS3_MultiCore" target="_blank">Multicore version of PureMVC</a> but this discussion will focus on the Standard version.</p>
<p><strong>The View</strong></p>
<p>This part of your application contains the MXML components, Mediators, custom events, and maybe some Interfaces.</p>
<p>Ideally, you should create a separate Flex Library project for all your MXML components. In this way your UI guy can easily take <strong>ownership</strong> of that area of your project. He does not need to share any code from the other developers, he just needs to focus on one separate and independent area of the application. He practically just needs to <em>checkout</em> a separate folder made especially for him only.</p>
<p>These MXML components <strong>do not know</strong> nor care about PureMVC or any other architecture that you may have in your project. Their only concern is the user interface. They take care of input from the user by dispatching appropriate events. They also <strong>expose</strong> a minimal set of API that allows interested parties (the Mediator in PureMVC&#8217;s case) to manipulate the user interface.</p>
<p>One example of this API exposure is an &#8220;update&#8221; function exposed by a custom tab navigation component that requires <strong>extra UI-only processing</strong> such as transition effects, alpha, hiding, disabling etc. These extra UI related processing or logic is encapsulated inside the component&#8217;s exposed &#8220;update&#8221; function. You may also even go as far as define a <strong>standard Interface</strong> for all related MXML components to implement to make it even easier and more intuitive for interested parties to access their API.</p>
<p>The <strong>Mediator</strong> is the entity that connects the MXML view components to PureMVC. It has a direct reference to <strong>one or more</strong> of your MXML components. If you are expecting that one of your Mediators will be taking care of more than one MXML component, it&#8217;s good practice to standardize access to these components via a common Interface. However, this does not mean you only have to register the Mediator once, you still have to register the Mediator for each MXML component it is interested in.</p>
<p>The heart of PureMVC is its <a title="PureMVC Notifications" href="http://ricoonflex.wordpress.com/2008/06/27/puremvc-notifications/" target="_blank">Notification system</a> and a large chunk of that can be found inside Mediators. From the name itself, the Mediator &#8220;mediates&#8221; the flow of data and acts as a <strong>middle man</strong> between the View and the rest of the application. The way it does this &#8220;mediating&#8221; is through Notifications.</p>
<p>The Mediator listens to events dispatched by the MXML components and <strong>forwards</strong> this to the rest of the application using Notifications. Commands mapped to the Notifications will be triggered. The Commands may then perform <strong>business logic</strong> related processing such as comparing values and deciding based on those values. This will in turn update the appropriate Proxy or more succinctly, update the application&#8217;s data.</p>
<p>The Mediator also handles Notifications it is interested in especially those coming from the Proxy. Since the Proxy takes care of the application&#8217;s data, any change to it should also <strong>reflect</strong> on the UI. This UI update process is also accomplished through Notifications. We will discuss details of the Proxy and it&#8217;s role in the program&#8217;s flow in another post.</p>
<p>You can also directly access Proxies (Model) from the Mediator but I do not recommend this approach since this will <strong>tightly couple</strong> your Mediators to your Proxies. I suggest you limit the Mediator&#8217;s role to sending and handling Notifications and just leave Proxies to your Commands (Controller). We will discuss this relationship (Mediator &lt;-&gt; Command &lt;-&gt; Proxy)  in detail in a later post.</p>
<p><strong>Summary</strong></p>
<p>Although I tried putting in everything I know so far about the framework, I&#8217;m sure I still missed a lot of essential stuff. Working with PureMVC entails continuous learning anyway so I&#8217;m sure we will be discovering more interesting things along the way.</p>
<p>I was planning to discuss all the aspects involved in the flow (the Model &amp; the Controller) in this post but decided to split them into parts seeing that this post has become this long already.</p>
<p>So much good stuff to discuss, think in <a title="PureMVC" href="http://www.puremvc.org/" target="_blank">PureMVC</a>!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ricoonflex.wordpress.com/73/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ricoonflex.wordpress.com/73/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ricoonflex.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ricoonflex.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ricoonflex.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ricoonflex.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ricoonflex.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ricoonflex.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ricoonflex.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ricoonflex.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ricoonflex.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ricoonflex.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ricozuniga.com&blog=908089&post=73&subd=ricoonflex&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ricozuniga.com/2008/07/26/puremvc-program-flow-part-1-the-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8cb66618cdd417e0d51872bf0b8f5739?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ricoz</media:title>
		</media:content>
	</item>
		<item>
		<title>PureMVC Notifications</title>
		<link>http://ricozuniga.com/2008/06/27/puremvc-notifications/</link>
		<comments>http://ricozuniga.com/2008/06/27/puremvc-notifications/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 11:29:09 +0000</pubDate>
		<dc:creator>ricoz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://ricoonflex.wordpress.com/?p=66</guid>
		<description><![CDATA[I&#8217;ve been trying to play around with the PureMVC framework during the past few weeks and I would like to post my thoughts on the subject. This will serve as my reference later on and may also be of help to others who are interested to learn the framework. One obvious thing I should point [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ricozuniga.com&blog=908089&post=66&subd=ricoonflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to play around with the <a title="PureMVC" href="http://puremvc.org/" target="_blank">PureMVC</a> framework during the past few weeks and I would like to post my thoughts on the subject. This will serve as my reference later on and may also be of help to others who are interested to learn the framework. One obvious thing I should point out is that the learning curve for PureMVC is quite steep. Familiarity with the concept of design patterns is a requisite to be able to understand the framwork.</p>
<p><strong>Notifications</strong> are similar to Flex Events. This may seem like a duplication of function at first but as you gain more understanding of this concept, you&#8217;ll learn to appreciate its purpose. Also a major reason why notifications exist is the language and framework agnostic nature of PureMVC. This approach made it possible for PureMVC to be ported to other languages or frameworks, not just Flex or AS3.</p>
<p>I&#8217;ll now proceed with the discussion of the major components of PureMVC and how they behave in relation to Notifications. I recommend going through the <a title="Minimalist MVC Example" href="http://www.as3dp.com/2007/12/27/minimalist-mvc-example-using-the-puremvc-framework/">Minimalist MVC Example</a> first to gain an understanding of the components that I will be discussing.</p>
<p><span id="more-66"></span></p>
<p><strong>Facade</strong>. The Facade sends only one Notification, the initialization event called <em>startup </em>by convention. It doesn&#8217;t listen to any other Notification. The Facade is also responsible for assigning or registering a <em>Command</em> with a Notification.</p>
<p><strong>Command</strong>. The Command only takes care of one Notification, the one assigned to it by the Facade. The Command is automatically invoked, or more specifically its <em>execute</em> method is invoked, whenever the Notification assigned to it is sent or triggered. In the execute method, you gain a handle to a <em>Proxy</em> via the Facade to retrieve, store, or manipulate data. The Command may also send a Notification to trigger an update in the user interface via the <em>Mediator</em>.</p>
<p><strong>Proxy</strong>. The Proxy cannot listen to Notifications. It however may also send a Notification that will trigger an update in the user interface. The Proxy takes care of retreiving and storing data and announcing these changes to interested UIs via Notifications. The <em>Mediator</em> listens to these Notifications and is the one responsible for updating the UI.</p>
<p><strong>Mediator</strong>. The Mediator is the only one allowed to listen to Notifications. It may also send a Notification that will trigger a Command and in turn cause an update to the application&#8217;s data via the Proxy. After the data has been updated, the Proxy may then send an update Notification that the Mediator can try to listen to and react to by updating the UI. The Mediator is also responsible for listening to native Flex events dispatched by the UI. Usually the Mediator reacts to these events by sending related Notifications, this is often referred to as &#8220;translating&#8221; from a native Flex Event to a PureMVC Notification.</p>
<p>So far this is how I understood PureMVC&#8217;s Notification system. Feel free to point out any mistakes or inconsistencies in the post. I will be using PureMVC in all upcoming projects and will be sharing my experience and learnings through this blog.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ricoonflex.wordpress.com/66/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ricoonflex.wordpress.com/66/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ricoonflex.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ricoonflex.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ricoonflex.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ricoonflex.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ricoonflex.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ricoonflex.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ricoonflex.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ricoonflex.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ricoonflex.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ricoonflex.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ricozuniga.com&blog=908089&post=66&subd=ricoonflex&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ricozuniga.com/2008/06/27/puremvc-notifications/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8cb66618cdd417e0d51872bf0b8f5739?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ricoz</media:title>
		</media:content>
	</item>
	</channel>
</rss>