aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Transfer Object Across Multiple Tiers? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Transfer Object Across Multiple Tiers?" Watch "Transfer Object Across Multiple Tiers?" New topic
Author

Transfer Object Across Multiple Tiers?

Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Is it okay to have a Business Object get a Transfer Object from a Data Access Object and return the Transfer Object as is to the web tier? I was thinking that the business objects could translate the transfer object they get back into an object of a different class before returning the data to the web tier but that seems like it would be really inefficient. Can anybody advise me on this? By the way, I'm talking about no more than 50 transfer objects being returned from the DAOs that only contain 5-10 primitive typed attributes and no object graph. Thanks a lot for any advice. I've been going over this in my head for a couple days now.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I would say it's ok to pass on the DTO's. If it becomes a problem, you can change it later. If you want to be sure you don't tie your web tier too closely on the middle tier, you could introduce an interface for each DTO to add flexibility.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Thanks. I think introducing an interface, as you suggested, is the way I'll go on my project.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transfer Object Across Multiple Tiers?