Hello all,
Assuming I am using a Flex/BlazeDS stack and am returning VOs to the proxies through a service and I need to massage the data for different views.
Say I have a collection of 50 VOs with a type field. Is it reasonable to have the proxy API take care of returning different sets of the data? So say I have UserServiceProxy.getCollection(type) and this returns the list of VOs I need of that particular type. Or should proxies be very dumb by default and provide the entire collection to manipulate? I am leaning towards Option 1.
Further if I don't want the base VO set modified, should I clone these before leaving the proxy (this is what I am assuming is correct) or should I clone them in the mediator before passing them to the view?
Option 1If we have 3 views, ViewA, ViewB, ViewC.
ViewA Mediator needs type A VOs, so UserServiceProxy.getCollection(A); // 15 cloned VOs of type A
ViewB Mediator needs type B VOs, so UserServiceProxy.getCollection(B); // 15 cloned VOs of type B
ViewB Mediator needs type B VOs, so UserServiceProxy.getCollection(C); // 20 cloned VOs of type C
Or should I go with
Option 2ViewA Mediator get the full collection, iterate over it and store and clone all A VOs.
etc...
In comparing it to a DAO architecture
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.htmlDo proxies act like a DAO (adapting the service calls to the model)? Or should proxies be more of just the data source and then have DAOs act as a layer above the proxies? My assumption is the proxies API is like the DAO API and allows the model to be decoupled and able to change independently of the system while the proxy API stays the same.
Thanks!