spring-mvcspring-bootdtoproxy-pattern

What is the difference between a Data Transfer Object (DTO) and a proxy object?


I just do not see the difference between the two.


Solution

  • It's hard to compare apples with oranges but the primary difference will be in their purpose and implementation of business logic.

    Data Transfer Object is used to carry the data between boundaries e.g. processes. It does not implement business logic and is only used to store, retrieve or serialize the data.

    Proxy Object is used as an intermediary to access some other object e.g. database connection. It can implement additional business logic.