The Artima Developer Community
Sponsored Link

Java Buzz Forum
Domain Objects as Data Transfer Objects

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Delap

Posts: 1154
Nickname: scottdelap
Registered: Sep, 2004

Client / Server application developer.
Domain Objects as Data Transfer Objects Posted: May 11, 2005 12:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Scott Delap.
Original Post: Domain Objects as Data Transfer Objects
Feed Title: ClientJava.com
Feed URL: http://www.clientjava.com/archives/wireless_mobile.rdf
Feed Description: Client/Desktop Related Java Development
Latest Java Buzz Posts
Latest Java Buzz Posts by Scott Delap
Latest Posts From ClientJava.com

Advertisement

This commentary on Domain Objects and DTO's makes several points that should be considered from the rich client perspective as well. The developer is considering the case of a J2EE based application with the UI served from a web application on another machine. With this setup data must be serialized and moved from one machine to another the same way a rich client application would serialized data requested from a server to the client. One point made is there can be flexibility in refactoring having a DTO layer that leverages your Domain Objects. The author does point out that major structural changes (the addition of new fields for instance) will require DTO modifications as well though. Another point raised is that compromises from a client perspective don't have to trickle down to your Domain Objects if you have a DTO layer. Finally, I think the point of unusable methods on Domain Objects is the most critical one to ponder. Especially today in our lazy loading Hibernate enabled world, a key problem to solve is fetching all the objects in the object graph at the right time. The moment you serialize an object and ship it across the wire, you've lost the ability to fetch other associations it has automatically as needed. With rich clients, decisions must be made in advance about how much data to retrieve. Otherwise, you have to write your own code to populate such lazy loaded associations at a later time.

I'm not sure there is a magic bullet with this issue of development. On one hand it is nice to just create some domain objects, a persistence mechanism, and ship them across the network when needed. On the other hand the flexibility gained by having an intelligent well designed DTO layer can also be very useful.

    Domain Objects as Data Transfer Objects

    ...I've been thinking not use Data Transfer Objects (DTOs) with this. I got this idea that maybe DTOs are not needed at all when reading "Hibernate In Action". The Hibernate guys told me in the book that I could use my domain objects as DTOs instead. I could just make some of the domain classes Serializable and move them across the wire from the business tier to the presentation tier. Then I could modify the objects within the presentation according to the user's gestures and after that move the object graph back to the business tier and have my changes persisted to the database. But how well will this work in practice?...

Read: Domain Objects as Data Transfer Objects

Topic: Introduction to JDNC Tables Previous Topic   Next Topic Topic: Site upgraded, turbulence expected

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use