PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: shizny on March 08, 2008, 11:24:12



Title: VOs and data object in Proxy
Post by: shizny on March 08, 2008, 11:24:12
I've got this little xml database that stores user's login and password.  I have used code peek as an example of how to deal with multiple datastores using the abstractProxy.  Here is my question.  In the userProxy I have the data object set to an xmllist in the user proxy.  Should I take the additional step and create a UserVo class that is instantiated and set in the userProxy as a private variable, or is there no need to use a vo when I could return an xmllist from a get User function in the userProxy?




Title: Re: VOs and data object in Proxy
Post by: sectore on March 09, 2008, 02:23:55
It might be helpful to use VOs dealing data in your app. So a Mediator can use a VO, e.g. UserVO, to populate its ViewComponent retrieving the Proxy. And the ViewComponent expects this type too.

Furthermore dealing with VOs gives you the possibility to replace your XML service with a Remote Service (e.g. AMFPHP) or anything else without changing the rest of the app. Because the getUser method in your UserProxy returns a type of UserVO and not a type of XMLList. That means the caller (a Mediator, a Command or another Proxy) will be independent of the result of your service.

Last but not least a ViewComponent can bind the VO using the [Bindable] metatag to update itself without breaking rules so long as your app is based on Flex  ;) .

-sectore


Title: Re: VOs and data object in Proxy
Post by: shizny on March 09, 2008, 12:28:42
thanks for the insight.


Title: Re: VOs and data object in Proxy
Post by: shauno on March 11, 2008, 12:34:23
Also, if you change the structure of your XML (maybe everything gets nested a little deeper or node names change) you only have to edit one file - the rest of the app remains unchanged. This has saved my bacon a bunch of times :)