Data transfer object
|This article needs additional citations for verification. (October 2013)|
Data transfer object (DTO) is an object that carries data between processes. The motivation for its use has to do with the fact that communication between processes is usually done resorting to remote interfaces (e.g. web services), where each call is an expensive operation. Because the majority of the cost of each call is related to the round-trip time between the client and the server, one way of reducing the number of calls is to use an object (the DTO) that aggregates the data that would have been transferred by the several calls, but that is served by one call only.
The difference between data transfer objects and business objects or data access objects is that a DTO does not have any behavior except for storage and retrieval of its own data (accessors and mutators). DTOs are simple objects that should not contain any business logic that would require testing.
This pattern is often incorrectly used outside of remote interfaces. This has triggered a response from its author where he reiterates that the whole purpose of DTOs is to shift data in expensive remote calls.
Note: A Value object is not a DTO. The two terms have been conflated by Java developers in the past.
- MSDN (2010). Data Transfer Object. Microsoft MSDN Library. Retrieved from http://msdn.microsoft.com/en-us/library/ms978717.aspx.
- Fowler, Martin (2010). Data Transfer Object. Patterns of Enterprise Application Architecture. Retrieved from http://martinfowler.com/eaaCatalog/dataTransferObject.html.
- LocalDTO. Retrieved from http://martinfowler.com/bliki/LocalDTO.html.
- Data Transfer Object - Microsoft MSDN Library
- jDTO Binder - an open source Java DTO/OOM Framework
- GeDA - generic dto assembler is an open source Java framework for enterprise level solutions
- Local DTO
|This computer programming-related article is a stub. You can help Wikipedia by expanding it.|