PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: eco_bach on July 23, 2009, 06:26:45



Title: Q:Communicating state between different proxies at runtime
Post by: eco_bach on July 23, 2009, 06:26:45
Hi
This is related to the cross-referencing proxies post but not quite the same issue I believe.
I am also a novice PureMVC'er so for my first app want to avoid using StartupManager or any other PureMVC utlities.

I have 3 proxies, 2 that handle uploading and saving of images to a remote server, and a third that manages user login, registration as well as current application 'states' defined as static constants.

My 2 'image' proxies need to communicate their 'state' to the UserProxy.
Would the simplest solution and best practice be to simply define a 'SiteProxy' which all 3 proxies extend?
And to define my static 'state' constants in this SiteProxy so that ALL proxies know about them?
Or should my existing proxies retrieve an instance of each other via the facade?


Title: Re: Q:Communicating state between different proxies at runtime
Post by: puremvc on July 26, 2009, 08:28:33
Application state management has been a well talked out subject around here; its been wrestled up one side of the swamp and down the other.

Proxies store data, and 'state' is arguably a form of data, so using a Proxy seems reasonable at first.

However there is one precept that should always be kept in the forefront of your mind when designing the Model tier for an RIA client: The Model may be reused in another application. Let this be your mantra. Imagine separate web, desktop and mobile clients being built on the same Model, just executing different use cases with a different UI.

In that light, storing state in a Proxy doesn't look so good. Because state is part of the application, not the domain model.

I can definitely agree with your eschewing the utilities until you get the basics down. However, when it comes to implementing state management within the client I must suggest that you have a look at the StateMachine utility and save yourself a lot of heartache. It's very simple to understand and use. Put on your headphones and have a listen to the overview presentation: http://puremvc.tv/#P003/

-=Cliff>