Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Beginner's Questions  (Read 9498 times)
citizen_conn
Newbie
*
Posts: 9


View Profile Email
« on: July 27, 2009, 01:06:55 »

Hi, I am new to the forums and new to PureMVC : ) I am fairly familiar with design patterns and try to implement them whenever possible, especially MVC in the vast majority of my projects, but I am trying to get a grasp on PureMVC and I think I understand some of the core concepts but there are still things I am stuck on so I hope this is the right place for me to request some knowledge...

In regards to Notifications I have one question: the getBody() method pulls the body parameter. Is that parameter pretty much just a placeholder to be able to pass any argument you want through a notification? In the examples I see, for Mediators, it is usually used to pass the stage object through. Should I designate this argument for something in particular in most cases?

My second question is about the facade... In the PureMVC world, how would one go about setting/getting a 'global' variable? Before I was using a singleton class I found that stores and instantiates global objects but I feel like with the facade, this should no longer be necessary... any tips for accomplishing this the right way?

Thanks lots for any help or feedback, direction etc you can provide :D
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 on: July 27, 2009, 04:29:58 »

In regards to Notifications I have one question: the getBody() method pulls the body parameter. Is that parameter pretty much just a placeholder to be able to pass any argument you want through a notification?
Yes, it is there to pass any information you need. You can also use the type parameter to pass any additional info. Just remember that body accepts any type (it's an object) where as the type parameter only accepts strings (makes it good for indentifers or descriminators).

My second question is about the facade... In the PureMVC world, how would one go about setting/getting a 'global' variable? Before I was using a singleton class I found that stores and instantiates global objects but I feel like with the facade, this should no longer be necessary... any tips for accomplishing this the right way?

You can use a proxy, it can be called from any of the actors (commands, mediators and other proxy's).
« Last Edit: July 27, 2009, 04:31:41 by Jason MacDonald » Logged
citizen_conn
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: July 28, 2009, 11:12:35 »

Thanks so much! This is very helpful, I guess thats the point of the proxy not only to load external data but just for any data storage at all....

Logged
Pages: [1]
Print