Why do you use dto java?

327    Asked by AkanshaChawla in Java , Asked on Oct 10, 2022

 What is the point of using DTO and is it an outdated concept? I use POJOs in the view layer to transfer and persist data. Can these POJOs be considered as an alternative to DTOs?

Answered by Owen Welch

DTO java is a pattern and it is implementation (POJO/POCO) independent. DTO says, since each call to any remote interface is expensive, response to each call should bring as much data as possible. So, if multiple requests are required to bring data for a particular task, data to be brought can be combined in a DTO so that only one request can bring all the required data. Catalog of Patterns of Enterprise Application Architecture has more details.


DTO's are a fundamental concept, not outdated.



Your Answer

Interviews

Parent Categories