Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transfer Object

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could somebody focus on the issues like synchronization and version control
associated with the Transfer Object design pattern?



Thanks,
 
Mark Garland
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that I fully understand the question.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look in Head First Servlets and JSPs. They have a nice discussion on Transfer Objects (or Value Objects).
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I was reading some content online regarding Transfer Object design
pattern. There were no detail but "synchronization and version control"
issues that is needed to care about.

Any idea/example would be helpful for me.


Thanks,
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you mean by 'version control'. As far as synchronization, I take it that you mean that data integrity - you retrieve data from a DB and build a Tranfer Object. It is potentially out of sync with the underlying data. This is one of the inherent problems with Transfer Objects
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you mean by 'version control'

You usually use a Transfer Object when using remote communication. Remote communication can be very slow, and to avoid many messages to be sent, you will use one Trnasfer Object, and put everything you need into it. Two machines are involved, and there are not the same (because it's remote). Both machines need the Transfer Object java source. So you have to be careful that both machines have the same version of the Transfer Object. Imagine that machine A is expecting the newest version of a Transfer Object, with a new property called "totalSales", but that machine B still holds an old version of the Transfer Object, without "totalSales". What's going to happen ?
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chandra, is this what you are asking?
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christopher,

Answer satisfies my eagerness.

Version Control and Serialization are two issues we have to care about.
Both the communicating machines must have same version of class otherwise
the same would occur that happens when while de-serializing an object
you change the definition of the class, provided you have not defined the
version UID for that class. So version of class changes that causes UID
to be changed and inconsistency occurs, de-serialization fails.
Serialization is an important aspect as well, when objects have to be
transferred from one machine to another.

Thanks Michael, I got the point.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic