tag:blogger.com,1999:blog-6852548432442154875.post7556278535806791818..comments2012-02-08T12:28:21.792+01:00Comments on Gunther Popp´s Blog: To DTO or not to DTO ...Gunther Popphttp://www.blogger.com/profile/13844671726935396728noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-6852548432442154875.post-34462776126178044262010-09-16T15:29:17.366+02:002010-09-16T15:29:17.366+02:00Great post, Gunther! Happy to see you blogging!Great post, Gunther! Happy to see you blogging!Markus Eiselehttps://www.blogger.com/profile/16195673592300911244noreply@blogger.comtag:blogger.com,1999:blog-6852548432442154875.post-68996416553939496422010-09-11T19:53:15.818+02:002010-09-11T19:53:15.818+02:00Mapping is boring, developers wants interesting pr...Mapping is boring, developers wants interesting problems to solve, not write repetitive code, but as a very influential .NET developer puts it, "In the fight between Don’t Repeat Yourself and Single Responsibility Principle, SRP wins, every single time." (http://ayende.com/Blog/archive/2010/09/09/maintainability-code-size-amp-code-complexity.aspx)Carlhttps://www.blogger.com/profile/14828480937686018825noreply@blogger.comtag:blogger.com,1999:blog-6852548432442154875.post-45221408615407678822010-09-09T09:04:03.350+02:002010-09-09T09:04:03.350+02:00Well, "minimal effort" is relative, of c...Well, "minimal effort" is relative, of course. DTOs always produce a significant overhead in a project. The approach that worked best for me until now was based on a mapping framework I´ve written myself. The basis for the framework was commons-beanutils. I´ll probably post a new article on the mapping variants later this month. Concering the idea using generated DTOs: I never tried it myself, but it certainly sounds interesting. I'm not sure if it would work for DTO models that have a significant distance to the domain model (this was the case in the project I mentioned above).Gunther Popphttps://www.blogger.com/profile/13844671726935396728noreply@blogger.comtag:blogger.com,1999:blog-6852548432442154875.post-9802249377285516892010-09-08T14:14:33.267+02:002010-09-08T14:14:33.267+02:00The issue of having to synchronize the DTO model a...The issue of having to synchronize the DTO model and the business model can be alleviated by using code-generating tools (annotation processing tool, XDoclet, etc.). The business model will change, but the code-generated DTOs can be recreated by just re-running the tool.Bogdan Marianhttps://www.blogger.com/profile/14635151263385046135noreply@blogger.comtag:blogger.com,1999:blog-6852548432442154875.post-45286201268604880082010-09-08T09:30:53.420+02:002010-09-08T09:30:53.420+02:00Good article. In a recent project I decided agains...Good article. In a recent project I decided against using DTO for the additional cost and effort they produce. We use JPA with with an OSIV filter and had a few problems with attached / detached state. So, i 'm looking on how to avoid that problems for the next project. Do you have any good links or comments on how to use DTO with minimal effort? Perhaps another post your experience with the different approaches you tried so far?<br />Thanks.https://www.blogger.com/profile/05024627608529256758noreply@blogger.comtag:blogger.com,1999:blog-6852548432442154875.post-58862935969747826742010-09-07T15:40:07.657+02:002010-09-07T15:40:07.657+02:00Right, I forgot to mention the interface stability...Right, I forgot to mention the interface stability issue. If you need to guarantee API stability on service level, DTOs are the way to go. Thanks for your comment!Gunther Popphttps://www.blogger.com/profile/13844671726935396728noreply@blogger.comtag:blogger.com,1999:blog-6852548432442154875.post-74680053675988051112010-09-07T14:14:49.495+02:002010-09-07T14:14:49.495+02:00Nice post, totally agree with you
additionally d...Nice post, totally agree with you <br /><br />additionally decoding to using or not using DTO may be dependent in your application architecture & design, for example in open session view we pass entity directly to view layer or over network which is not possible with DTO. But in my experience DTO protected your application from changes in your data model. And additionally it may improve performance of application. And finally you should care about some exception (Lazy Initialization) when using entity as DTO.MyOpenDrafthttps://www.blogger.com/profile/01428625409449689500noreply@blogger.com