PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: jgervin on March 23, 2009, 03:23:40

Title: Proxy referencing other proxies
Post by: jgervin on March 23, 2009, 03:23:40
Is it bad form to have proxies referencing other proxies, so as to have access to the retrieved proxies data?

Or would it be better to use a command to create a proxy and send in the data from another proxy then.

execute {
facade.retrieProxy (myproxy);
facade.registerProxy( new Proxy( myproxy.getData() ) );

Title: Re: Proxy referencing other proxies
Post by: puremvc on March 23, 2009, 03:49:56
There's no problem at all with a proxy registering, retrieving or removing another Proxy. Think of it this way: what if you had an app that runs on desktop, mobile and browser, all using the same model, but applyong different use cases against it according to the form factor and capabilities unique to each of those platforms? You'd want a highly portable, internally consistent set of model classes (proxies) that take care of themselves and do not rely on the app to keep them consistent. You'd package them in a library used by all three apps and manage them as a separate project. So they'd need to be able to interact with each other in this way.