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: Proxy and nested data  (Read 6553 times)
tucdough
Newbie
*
Posts: 1


View Profile Email
« on: February 21, 2010, 08:18:53 »

Hi,

i think PureMVC works great with apps that are using "flat" data (e.g. one object with members of primitive data types) but not with complex and hierarchical data (objects having lists of other objects)?

Every proxy and mediator needs to get named. This won't let me create more than one instance otherwise naming gets messy?

I would like to know how a proxy might look like to work with nested data.

Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 22, 2010, 10:13:45 »

Proxies and Mediators can be dynamically named allowing you to have more than one instance. As long as the name you pass to the super class constructor is unique, you're set. The idiom of using a NAME constant is for the 90+% of Mediators and Proxies that only ever need a single instance.

As far as nested data goes, the data object of a Proxy can be a complex object or a collection of such. If the Proxy needs to expose methods to work with parts of the data, it can do so, but can become a little chunky if it has lots of methods. At which point I often create other proxies for the sub-objects and have the proxy for the master object register the sub object proxies with its reference to them. This is the same as how a Mediator for a complex object may register other mediators for its view component's children.

-=Cliff>
Logged
Pages: [1]
Print