PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: rbhadra on August 19, 2008, 10:15:07



Title: Declaration of Notification Names ?
Post by: rbhadra on August 19, 2008, 10:15:07
Hi,
I want to know where one should declare notification names. It shud be declared in Proxies or in ApplicationFacade ?
I want to make modular applications so wanted to know what is the best way of maintaining notifications.
Declaring notification names in ApplicationFacade will really lengthen up the file. I was thinking to declare in a separate file called as ApplicationConstants but is there any other method of keeping the notification names..whether in proxies or applicationfacade ??
Your insights will be really helpful.


Title: Re: Declaration of Notification Names ?
Post by: danielcsgomes on August 19, 2008, 10:43:03
Hi rbhdra,

Well, i'm not the best person to advice you but i can tell you for me what makes sense.

First, if you are using AS3 port it will depends if is multicore or Standard. When i developed my first app i always try to make my code more reusable possible and separate it into modules.

In my first application what I did was as follows:

Where had to declare a notification it was always in place that made the code more reusable, that is, imagine you have a "module" Login where you need to declare the following Notifications: "TRY_LOGIN", "LOGIN_SUCCESS" and "LOGIN_FAILED" from my point of view i declare them in LoginProxy because it is something about the Login.

In case such an application to have a ViewStack which has two components such as Login and then UserManager, here i declared the notifications in ApplicationFacade because both modules did not "know" each other, but the application has to be aware of them.

I'm studying MultiCore but for me when i start with multicore make sense declare some Notification in ApplicationFacade and other in Proxy of each Module (for me i think it always depend on the kind of the notification to declare).

I do not know if you understand my "philosophy" that thought and that seemed the right one, probably can not even be the better way.

I hope I have helped, and don't forget that is just my point of view ;)

Daniel Gomes


Title: Re: Declaration of Notification Names ?
Post by: puremvc on August 19, 2008, 05:31:34
Hi Folks,

Although this is covered in the Best Practices document, it could still use a separate FAQ with a little more elaboration, so you can find the answer here:

http://puremvc.org/content/view/93/185/

-=Cliff>