You may have seen in some Java codes there are Java class names end with ...DTO and ...DAO. Why do we need this practice?
First of all let's look at what they stand for?
DTO : Data Transfer Object
DAO : Data Access Object
DTO objects are used to
transfer data between classes and modules of an application. DTO consists of only private fields, getters, setters and
constructors. It is not recommended to add business logic methods to
such classes. But they may contain some util methods.
They abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data.
Here is a good explanation about the DAO pattern.
No comments:
Post a Comment