PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: Vander on September 21, 2008, 09:05:20



Title: ONE PROXY, TWO VO´S
Post by: Vander on September 21, 2008, 09:05:20
hi... im near finish my first great system using puremvc... its very good to work with flex3/pmvc/amfphp/eclipse bla bla ;D

ive a doubt

whats the best way to work with more than one vo, in a proxy?

because super initializes the "first one", so i can use setData(vo)

but
im needing to use one more VO... how its the best approx?

thanks.
Vander.


Title: Re: ONE PROXY, TWO VO´S
Post by: puremvc on September 22, 2008, 04:52:09
Are these VOs of the same type if so just use an ArrayCollection as the Proxy's data object and put the VOs in the collection.

Otherwise, are the VOs truly so interrelated that you need the same Proxy to handle them? Does the Proxy need to update one whenever the other changes or something? If not perhaps consider two separate Proxies.

-=Cliff>


Title: Re: ONE PROXY, TWO VO´S
Post by: Sammi on October 22, 2008, 01:37:36
Hmmmm,

so you recommend that each Proxy is usually only managing a single VO?

I put all kinds of properties (vo's or not) in the proxy and provide getters and setters to them.

Best,
Sammi


Title: Re: ONE PROXY, TWO VO´S
Post by: puremvc on October 23, 2008, 05:07:25
Well toy can do this but often that leads to prickly code at the mediator where you're pulling 10 properties off a Proxy and setting them on the view component. Or worse, giving a Proxy reference to the view component.

That's what VOs are for. Wadding up a bunch of related props and tossing them over to another tier.

So its best to have one VO or a collection of the same type as data object for the Proxy.

Adding getters and setters to the Proxy that manipulate the VO is ok, and its also often the case that XML is used instead of a VO, since E4X can make the Proxy's life easier at filtering or querying its data.

-=Cliff>


Title: Re: ONE PROXY, TWO VO´S
Post by: marek on November 07, 2008, 07:24:08
Hi guys.

Got similar problem some time ago and did use 3 diferent VO sending to my GameProxy that provides me a configuration for whole application.
Becouse I was migrating to pureMVC from old version of these application didn't want to create 5 separate proxies. Whole config contains sets of data that came from diferent places. Data is used across whole application so I did grouped it and and now access it by:

first retrieving a proxy
:
var gameProxy: GameProxy;
gameProxy = facade.retrieveProxy( LoginProxy.NAME ) as LoginProxy;
and then simple:
:
gameProxy.stage;and diferent group (internal object):
:
gameProxy.config.url;
gameProxy.config.assetsURL;
gameProxy.config.gatewayURL;
gameProxy.config.sessionURL;
gameProxy.config.serviceName;
gameProxy.config.loaderinfo;
and next one:
:
gameProxy.acc.loggedin;
gameProxy.acc.accountid;
gameProxy.acc.lastactionid;

etc...
the VO objects are strored in app.model.common.vo