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: Q:Communicating state between different proxies at runtime  (Read 6667 times)
eco_bach
Courseware Beta
Sr. Member
***
Posts: 81


View Profile Email
« 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?
« Last Edit: July 23, 2009, 07:53:51 by eco_bach » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
Pages: [1]
Print