HomeToolsAbout

DTO

What is it

Source

Object that carries data between processes in order to reduce the number of method calls

Detailed description

Each call to remote interface is expensive.

To reduce the number of calls, you need to transfer more data per call.

  • One way to transfer more data is to use lot of parameters, but this is awkward to program (and not possible with languages such as Java that returns only a single value)

DTO holds all the data for the call.

  • It serializes the data to go across the connection
  • Usually an assembler is used in server to transfer data between the dTO and any domain objects
  • Main advantage is to batch up multiple remote calls to a single call

Another advantage of DTO is encapsulating the serialization mechanism for transferring data over the wire

  • By encapsulating the serialization, DTOs keep the logic out of the rest of the code and provide a clear point to change serialization
AboutContact