<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Organizing PureMVC Notifications</title>
	<atom:link href="http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/</link>
	<description>Blog of the Talent at Almer/Blank</description>
	<lastBuildDate>Wed, 21 Jul 2010 18:54:56 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: matt</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-196</link>
		<dc:creator>matt</dc:creator>
		<pubDate>Tue, 18 May 2010 12:33:42 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-196</guid>
		<description>Hey Hasan, 

Cool addition with the public var notifications in the facade. If this was added to the framework it would remove the need to create concrete facades in many cases. Also the protected variable facade provided by the Notifier class would always allow access to all notifications. Thus also the dynamic adding and removing of commands could be solved that way.</description>
		<content:encoded><![CDATA[<p>Hey Hasan, </p>
<p>Cool addition with the public var notifications in the facade. If this was added to the framework it would remove the need to create concrete facades in many cases. Also the protected variable facade provided by the Notifier class would always allow access to all notifications. Thus also the dynamic adding and removing of commands could be solved that way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sideDoor</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-88</link>
		<dc:creator>sideDoor</dc:creator>
		<pubDate>Thu, 07 Jan 2010 02:25:57 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-88</guid>
		<description>Great stuff!

@hasanotuome:

Following your approach, how are you accessing the &quot;notes&quot; variable of the ApplicationFacade from within Mediators, Proxies and Commands?

Mediators, Proxies and Commands have the inherited instance-variable facade, a reference to the Facade supertype, but it is typed to IFacade, so, for example, we cannot use facade.notes.login.LOGOUT to get at the constant (notification name).  

We can use ApplicationFacade.getInstance().notes.login.LOGOUT, but of course, we have to import our concrete ApplicationFacade class into each actor where needed.

What&#039;s your approach here?

Thanks,
jf</description>
		<content:encoded><![CDATA[<p>Great stuff!</p>
<p>@hasanotuome:</p>
<p>Following your approach, how are you accessing the &#034;notes&#034; variable of the ApplicationFacade from within Mediators, Proxies and Commands?</p>
<p>Mediators, Proxies and Commands have the inherited instance-variable facade, a reference to the Facade supertype, but it is typed to IFacade, so, for example, we cannot use facade.notes.login.LOGOUT to get at the constant (notification name).  </p>
<p>We can use ApplicationFacade.getInstance().notes.login.LOGOUT, but of course, we have to import our concrete ApplicationFacade class into each actor where needed.</p>
<p>What&#039;s your approach here?</p>
<p>Thanks,<br />
jf</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neil manuell</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-31</link>
		<dc:creator>neil manuell</dc:creator>
		<pubDate>Tue, 01 Dec 2009 08:10:46 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-31</guid>
		<description>@polykrom
if your framework actors do not have references to the facade, then they haven&#039;t initialised yet, override the onRegister method an put the code there. This will ensure that the facade is available 
cheers :)</description>
		<content:encoded><![CDATA[<p>@polykrom<br />
if your framework actors do not have references to the facade, then they haven&#039;t initialised yet, override the onRegister method an put the code there. This will ensure that the facade is available<br />
cheers <img src='http://labs.almerblank.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-22</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Mon, 16 Nov 2009 15:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-22</guid>
		<description>Bookmarked! Love it.</description>
		<content:encoded><![CDATA[<p>Bookmarked! Love it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: polykrom</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-20</link>
		<dc:creator>polykrom</dc:creator>
		<pubDate>Sun, 15 Nov 2009 07:19:43 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-20</guid>
		<description>@hasanotuome

I&#039;ve use your solution in my new application to define my notifications constants, but there was a problem because the concrete facade wasn&#039;t already accessible from my different mediators and proxies while registrating them, the facade returned null, so it was impossible to access my notifications vars. 

So, i had to create a getter in my differents mediators and proxies to access the facade like this :


protected function get _facade():LoginModuleFacade
{
if ( multitonKey == null ) throw Error( MULTITON_MSG );
return Facade.getInstance( multitonKey ) as LoginModuleFacade;
}

don&#039;t know if it&#039;s the right way to do this...</description>
		<content:encoded><![CDATA[<p>@hasanotuome</p>
<p>I&#039;ve use your solution in my new application to define my notifications constants, but there was a problem because the concrete facade wasn&#039;t already accessible from my different mediators and proxies while registrating them, the facade returned null, so it was impossible to access my notifications vars. </p>
<p>So, i had to create a getter in my differents mediators and proxies to access the facade like this :</p>
<p>protected function get _facade():LoginModuleFacade<br />
{<br />
if ( multitonKey == null ) throw Error( MULTITON_MSG );<br />
return Facade.getInstance( multitonKey ) as LoginModuleFacade;<br />
}</p>
<p>don&#039;t know if it&#039;s the right way to do this&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ódýr Vefhýsing</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-17</link>
		<dc:creator>Ódýr Vefhýsing</dc:creator>
		<pubDate>Mon, 09 Nov 2009 15:33:52 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-17</guid>
		<description>This is a really good idea! Thanks for the heads up and great work!

Regards,
Ódýr Vefhýsing</description>
		<content:encoded><![CDATA[<p>This is a really good idea! Thanks for the heads up and great work!</p>
<p>Regards,<br />
Ódýr Vefhýsing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: uberVU - social comments</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-16</link>
		<dc:creator>uberVU - social comments</dc:creator>
		<pubDate>Sat, 07 Nov 2009 03:54:30 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-16</guid>
		<description>&lt;strong&gt;Social comments and analytics for this post...&lt;/strong&gt;

This post was mentioned on Twitter by nebutch: My coworker at Almer/Blank wrote up a good article on PMVC notification organization. http://bit.ly/4EhPue...</description>
		<content:encoded><![CDATA[<p><strong>Social comments and analytics for this post&#8230;</strong></p>
<p>This post was mentioned on Twitter by nebutch: My coworker at Almer/Blank wrote up a good article on PMVC notification organization. <a href="http://bit.ly/4EhPue..." rel="nofollow">http://bit.ly/4EhPue&#8230;</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Organizing PureMVC Notifications - Almer/Blank Labs -- Topsy.com</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-14</link>
		<dc:creator>Tweets that mention Organizing PureMVC Notifications - Almer/Blank Labs -- Topsy.com</dc:creator>
		<pubDate>Fri, 06 Nov 2009 19:20:09 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-14</guid>
		<description>[...] This post was mentioned on Twitter by Helio S. Junior and Nolan Butcher, Philip Heyde. Philip Heyde said: RT @H3li0: Organizing PureMVC Notifications - Almer/Blank Labs http://bit.ly/4nZYUf [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Helio S. Junior and Nolan Butcher, Philip Heyde. Philip Heyde said: RT @H3li0: Organizing PureMVC Notifications &#8211; Almer/Blank Labs <a href="http://bit.ly/4nZYUf" rel="nofollow">http://bit.ly/4nZYUf</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hasanotuome</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-13</link>
		<dc:creator>hasanotuome</dc:creator>
		<pubDate>Fri, 06 Nov 2009 03:03:45 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-13</guid>
		<description>@Will,

If you use public const vs public static const in your Notification classes and then create instances of your Notification classes in your Facade, you won&#039;t need additional imports in your Mediators, Proxies or Commands as they will still be available via your concrete Facade. 

You could further expand this approach by wrapping all your Notification classes in a Notifications class and letting this be the intermediary between your concrete Facade and Notifications.

&lt;pre lang=&quot;actionscript3&quot;&gt;
package com.project
{
	import com.project.controller.notifications.Notifications;
 
	import org.puremvc.as3.patterns.facade.Facade;
 
	public var notes:Notifications;
	
	public class ProjectFacade extends Facade
	{
		public function ProjectFacade()
		{
			super();
		}
 
		static public function getInstance():ProjectFacade
		{
			if (!instance) instance = new ProjectFacade();
 
			return instance;
		}
 
		override protected function initializeController():void
		{
			super.initializeController();
 
			notes = new Notifications( this );
		}
	}
}
&lt;/pre&gt;

That&#039;s your modified Facade and here&#039;s the Notifications wrapper class:

&lt;pre lang=&quot;actionscript3&quot;&gt;
package com.project.controller.notifications
{
	import org.puremvc.as3.interfaces.IFacade;
 
	public class Notifications
	{
		public var application:ApplicationNotifications;
		public var login:LoginNotications;
	
		public function Notifications( facade:IFacade )
		{
			application = new ApplicationNotifications( facade );
			login = new LoginNotifications( facade );
			// etc, etc...
		}
	}
}
&lt;/pre&gt;

And finally, your slightly modified Notification class:

&lt;pre lang=&quot;actionscript3&quot;&gt;
package com.project.controller.notifications
{
	import com.project.controller.commands.LoginCommand;
	import com.project.controller.commands.LogoutCommand;
 
	import org.puremvc.as3.interfaces.IFacade;
 
	public class LoginNotifications
	{
		public const LOGIN:String = &quot;LOGIN_NOTIFICATION&quot;;
 
		public const LOGOUT:String = &quot;LOGOUT_NOTIFICATION&quot;;
 
		public function LoginNotifications( facade:IFacade )
		{
			facade.registerCommand( LOGIN, LoginCommand );
			facade.registerCommand( LOGOUT, LogoutCommand );
		}
	}
}
&lt;/pre&gt;


Each Notification class would still handle its command registration process and you would gain access to your Notifications using the &lt;b&gt;notes&lt;/b&gt; attribute in your concrete Facade. Hope this helps...</description>
		<content:encoded><![CDATA[<p>@Will,</p>
<p>If you use public const vs public static const in your Notification classes and then create instances of your Notification classes in your Facade, you won&#039;t need additional imports in your Mediators, Proxies or Commands as they will still be available via your concrete Facade. </p>
<p>You could further expand this approach by wrapping all your Notification classes in a Notifications class and letting this be the intermediary between your concrete Facade and Notifications.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.project
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> com.project.controller.notifications.Notifications;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.puremvc.as3.patterns.facade.Facade;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> notes<span style="color: #000000; font-weight: bold;">:</span>Notifications;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ProjectFacade extends Facade
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ProjectFacade<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		static <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>ProjectFacade
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>instance<span style="color: #000000;">&#41;</span> instance = <span style="color: #0033ff; font-weight: bold;">new</span> ProjectFacade<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">return</span> instance;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> initializeController<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span>.initializeController<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			notes = <span style="color: #0033ff; font-weight: bold;">new</span> Notifications<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>That&#039;s your modified Facade and here&#039;s the Notifications wrapper class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.project.controller.notifications
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> org.puremvc.as3.interfaces.IFacade;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Notifications
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> application<span style="color: #000000; font-weight: bold;">:</span>ApplicationNotifications;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> login<span style="color: #000000; font-weight: bold;">:</span>LoginNotications;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Notifications<span style="color: #000000;">&#40;</span> facade<span style="color: #000000; font-weight: bold;">:</span>IFacade <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			application = <span style="color: #0033ff; font-weight: bold;">new</span> ApplicationNotifications<span style="color: #000000;">&#40;</span> facade <span style="color: #000000;">&#41;</span>;
			login = <span style="color: #0033ff; font-weight: bold;">new</span> LoginNotifications<span style="color: #000000;">&#40;</span> facade <span style="color: #000000;">&#41;</span>;
			<span style="color: #009900;">// etc, etc...</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And finally, your slightly modified Notification class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.project.controller.notifications
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> com.project.controller.commands.LoginCommand;
	<span style="color: #0033ff; font-weight: bold;">import</span> com.project.controller.commands.LogoutCommand;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.puremvc.as3.interfaces.IFacade;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> LoginNotifications
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> const LOGIN<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;LOGIN_NOTIFICATION&quot;</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> const LOGOUT<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;LOGOUT_NOTIFICATION&quot;</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> LoginNotifications<span style="color: #000000;">&#40;</span> facade<span style="color: #000000; font-weight: bold;">:</span>IFacade <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			facade.registerCommand<span style="color: #000000;">&#40;</span> LOGIN, LoginCommand <span style="color: #000000;">&#41;</span>;
			facade.registerCommand<span style="color: #000000;">&#40;</span> LOGOUT, LogoutCommand <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Each Notification class would still handle its command registration process and you would gain access to your Notifications using the <b>notes</b> attribute in your concrete Facade. Hope this helps&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://labs.almerblank.com/2009/11/organizing-puremvc-notifications/comment-page-1/#comment-12</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Thu, 05 Nov 2009 22:51:53 +0000</pubDate>
		<guid isPermaLink="false">http://labs.almerblank.com/?p=1071#comment-12</guid>
		<description>Your point about saving on imports in the Facade is a little odd. What you save on imports in the Facade you make up with imports in your Mediators, Proxies and Commands, right? You&#039;ll have to import the LoginNotifications class whenever you need to reference it&#039;s constances. 

Don&#039;t get me wrong, I actually really like the idea of creating locial groups notifications and it certainly outweighs the imports issue. I&#039;ll probably try this on my next project. Thanks for sharing!</description>
		<content:encoded><![CDATA[<p>Your point about saving on imports in the Facade is a little odd. What you save on imports in the Facade you make up with imports in your Mediators, Proxies and Commands, right? You&#039;ll have to import the LoginNotifications class whenever you need to reference it&#039;s constances. </p>
<p>Don&#039;t get me wrong, I actually really like the idea of creating locial groups notifications and it certainly outweighs the imports issue. I&#039;ll probably try this on my next project. Thanks for sharing!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
