topleft
topright

OReilly PureMVC Book

PureMVC Book

PureMVC TV

PureMVC TV

PureMVC on the Web

PureMVC Blog-o-Sphere
PureMVC on LinkedIn
 
Image
 
Where Should I Declare Notification Name Constants
Tuesday, 19 August 2008

QUESTION:

I want to know where one should declare notification name constants. Should they be declared in Proxies or in ApplicationFacade?
 
Also, declaring notification constants in my ApplicationFacade will really lengthen up the file. I was thinking of declaring them in a separate file called as ApplicationConstants but is there any other method of keeping the notification names?

ANSWER:

The concrete facade for your application (typically called ApplicationFacade) is just a handy place common to all the notification participants, and since it also uses constants for Command / Notification mappings, it is usually a reasonable place, if you don't have many constants defined.

But you have a lot of constants you can just as well put them into a separate file like ApplicationConstants. Keep it at the same level in your hierarchy as your ApplicationFacade. This is particularly useful if the constants are to be shared, as in a library.

 

The View tier and Controller tier work together to service the unique use cases of a single given application, but you don't want Mediators referring to constants defined on Commands or visa-versa, otherwise they'd be in the same tier. So a common, neutral place like the ApplicationFacade or an ApplicationConstants file allows the two to work together without forming dependencies on each other.

 

And since an application's unique View and Controller tiers are almost always meant to allow you to interact with a specific Model, is perfectly fine for both Commands and Mediators to be mapped to Notification constants defined in the Model tier (typically in Proxies or ModelConstants classes), and to retrieve and interact with the Proxies directly. 

 

However, the Model should be the most isolated tier, able to be moved in its entirety to another application (perhaps the AIR version of a Flex app) with completely different use cases and UI (View/Controller tiers).

 

Therefore, the Model tier (Proxies) should not reference anything specific to your Controller/View tiers or your ApplicationFacade/ApplicationConstants.

 

You should have the Model define its own constants for the Notifications it sends. This makes the Model tier portable. This is also why Proxies cant receive Notifications - you might be tempted to make them listen for Notifications that are defined elsewhere in the application, thus forming an undesirable Model dependency on the View/Controller tiers.
Delicious
Technorati
Reddit
Furl it!
NewsVine
YahooMyWeb
Stumble
blogmarks
Digg
co.mments
connotea
 

PureMVC on the Web

João Pescada has produced a nice PureMVC / AS3 demo - a searchable image gallery. 
 
Photo Search with PureMVC - Article  -  Code  -  Demo

 

 
Jonathan Campos has put together a nice introductory PureMVC article with an example built around the Netflix API.
 
Netflix API with PureMVC Article

 
The guys over at Pyjamas (a Python port of GWT) have made their compiler so efficient that it can take virtually any Python library and it will compile to Javascript. They loved the look of PureMVC Python, and decided to do a couple of demos that use it.
 

Pyjamas Project

• EmployeeAdmin Demo: Original / Pyjamas  

Pyjamas PureMVC Timesheet Demo

 
Chandima Cumaranatunge, co-author of the O'Rielly book AS3 Design Patterns, and long-time PureMVC community member recently created a simple Flash/AS3 MultiCore demonstration application accompanied by an informative article that's an excellent introduction to the benefits of working with MultiCore.
 
Who Moved the Cheese? - Demo / Source / Article

ActionScript 3 Design Patterns

 

Ahmed Nuaman has published a well conceived and received AS3/PureMVC tutorial at FlashTuts.com. It's a good place for the learner to get their feet wet, and goes into the difference between using PureMVC with Flex as opposed to Flash or pure AS3.

 

Understanding the PureMVC Open Source Framework

FlashTuts Website
Ahmed's Website

 

 

Recent Project Activity

The PureMVC MultiCore framework for  Native JavaScript is now available. It has no dependency on other frameworks and provides its own optional namespace and class simulation.

 

 

 

PureMVC Standard Version for Perl 1.0  has been released, complete with unit tests and online documentation.

 

PureMVC Standard Framework for Perl

 

Release 1.3 of the AIR DesktopCitizen Utility which allows applications to remember their window size, position and maximized/minimized state each time it is launched. It also provides a facility for requiring confirmation (or executing some shutdown process) before the application window closes.

 

AS3 / AIR Desktop Citizen Utility

CodePeek Demo

 

The classic PureMVC EmployeeAdmin Demo has been ported to yet another language! Although PHP is usually thought of as a server language, using PHP-GTK, Sasa Tarbuk recreates th a desktop app. 

 

 
Version 1.0.8 of the PureMVC Java MultiCore port is now available. It supports JavaFX and handles threading properly.

 

 
Copyright (c) 2006-2012 Futurescale, Inc.