Misplaced Pages

Data transfer object

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
(Redirected from Data Transfer Object) Programming object that carries data

In the field of programming a data transfer object (DTO) is an object that carries data between processes. The motivation for its use is 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, retrieval, serialization and deserialization of its own data (mutators, accessors, serializers and parsers). In other words, DTOs are simple objects that should not contain any business logic but may contain serialization and deserialization mechanisms for transferring data over the wire.

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.

Terminology

A value object is not a DTO. The two terms have been conflated by Sun/Java community in the past.

For model-view-viewmodel pattern, the data transfer object can be referred to as the viewmodel.

References

  1. ^ MSDN (2010). Data Transfer Object. Microsoft MSDN Library. Retrieved from https://msdn.microsoft.com/en-us/library/ms978717.aspx.
  2. ^ Fowler, Martin (2010). Data Transfer Object. Patterns of Enterprise Application Architecture. Retrieved from http://martinfowler.com/eaaCatalog/dataTransferObject.html.
  3. LocalDTO. Retrieved from http://martinfowler.com/bliki/LocalDTO.html.
  4. Microsoft Learn (3 January 2024). "Tutorial: Create a web API with ASP.NET Core".

External links

Software design patterns
Gang of Four
patterns
Creational
Structural
Behavioral
Concurrency
patterns
Architectural
patterns
Other
patterns
Books
People
Communities
See also


Stub icon

This computer-programming-related article is a stub. You can help Misplaced Pages by expanding it.

Categories:
Data transfer object Add topic