Data Transfer Objects
Data Transfer Objects
These are objects which are used to hold and transmit information between different processes. The processes could be different services within the same application or could be spread across multiple application in a distributed system. The application may be communicating with each other using Remote calls like RMI or web services (SOAP or REST).
Communication between different applications/modules is very expensive due to the fact that it involves steps like opening connection, transmitting data over the network and closing it.
Data transfer objects are meant as a way of aggregating all the information that needs to be transferred, into a simple coherent entity and get it across to the other side without executing too many expensive operations.
Below diagram describes a scenario without the user of data transfer objects. In this case multiple calls are being made to the application service to retrieve the required information.