If my objects are for the most part simply holding data that will be sent to the View, does it make sense to implement a separate Service class to initialize object, retirve data and make assignments? Instead, shouldnt the object 'know' what it has to do when it is instantiated, and thus make appropriate calls to repository as needed?
+1
A:
like active record? I think that DTO + DAO or domain object + repository is a better design most of times
dfa
2009-06-05 20:01:19
+1
A:
My approach is use separate sometimes called ViewModel for storing data that will be displayed on View, more information about that.
About using additional service, when I implemented similar infrastructure I examined many sample and real open source application. My summary is:
1. You could use separate service that fill fat ViewModel class, look at Suetki Shop (fat ViewModel is Model that has many different Properties for displaying data not for one view, but for some group of views)
2. Use separate ViewModel for every view
As for me ViewModel must be POCO object, without any logic, and calls.
pocheptsov
2009-06-05 20:02:32