Timeline for Using business objects in view models
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 3, 2012 at 10:09 | comment | added | MattDavey | @MichaelBorgwardt see my answer if you want to talk about SRP | |
Aug 3, 2012 at 10:01 | comment | added | Michael Borgwardt | @MattDavey: It sounds like the domain models you're used to working with are not just rich but veritable kleptocrats. I don't like anemic models either, but they're still models, and their behaviour should be confined to representing the domain. Single responsibility principle and all that... | |
Aug 2, 2012 at 22:15 | comment | added | MattDavey | @MichaelBorgwardt it sounds like you're used to working with anemic domain models where the entities are little more than property bags with little or no behaviour. In that case yes, a DTO/View-model would basically be a duplicate. However if you have a rich domain model with complex relationships, a layer of DTOs/View-models becomes necessary, and they will not be so similar to the domain entities. | |
Aug 2, 2012 at 20:40 | comment | added | Michael Borgwardt | Sorry, but THAT is horrible advice for any application, period. It leads to overengineered applications full of duplicate code that are the exact opposite of flexible. | |
Aug 2, 2012 at 16:23 | history | edited | gnat | CC BY-SA 3.0 |
edited body
|
Aug 2, 2012 at 16:07 | comment | added | Jeff Camera | @MichaelBorgwardt Yes, this is what a view model SHOULD be. You don't want to be serializing your domain models and sending them all over the place. All business logic should stay safely at home in one place. The views however should be flexible and able to be rendered on any device which is why you want to completely separate your STRUCTURE, DATA and STYLE. | |
Aug 2, 2012 at 15:59 | comment | added | Michael Borgwardt | I've never had any problems with serializing domain models. And converting everything to strings in a model? Seriously? | |
Aug 2, 2012 at 15:55 | history | answered | Jeff Camera | CC BY-SA 3.0 |