πŸ“šDTO vs DAO

Describe about DTO and DAO

A DTO or Data Transfer Object is an object used for data sent between classes and modules within an application. Use DAOs or Data Access Objects for encapsulating logic that manages data sources.

Example

interface PersonDTO {
    String getName();
    void setName(String name);
    //.....
}

interface PersonDAO {
    PersonDTO findById(long id);
    void save(PersonDTO person);
    //.....
}

Last updated