At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What Are Data Access Objects?

Troy Holmes
Troy Holmes

In computer programming, data access objects (DAO) are a design technique that creates a module layer to manage all data access for a software program. This layer is responsible for reading and writing data to a database or external file system. In software design, there are many ways to read and write data to a database. This can cause sloppy software code because developers may use multiple methods to perform the same data access task. One of the primary benefits of using DAOs is the ability to standardize how data is accessed for a software program. The DAO design ensures that all database access will be performed in a similar manner, which makes better software.

Data access objects were first introduced academically in the object-programming model. This architecture approach requires that software be built into specific modules with a specific purpose. The DAO is a software module that has the responsibility of retrieving and modifying all data from any data storage device.

Woman doing a handstand with a computer
Woman doing a handstand with a computer

The technique of using DAOs is not unique to a specific programming language. Microsoft MS Access first introduced this approach, but it is currently available in most modern programming languages. It is considered a best practice to centralize data access because it makes the software application flexible. This technique can save valuable development hours because it creates a reusable module for the database.

One example of data access objects in practice is the page-by-page display of results that is often found in a web browser. When the first page of results is displayed after a search, the screen typically allows the user to select the next page of data. This uses the DAO pattern, which allows the user to move forward and backward through a set of data.

Many software frameworks have implemented the data access objects within software tools. Some examples include hibernate, spring, and java data objects (JDO). These frameworks are useful for software developers because they have encapsulated the DAO pattern within the framework, making it hidden from the developer.

Using the data access objects can also save time with testing and deployment of software code. The single coding module is responsible for the data access for the entire application. This makes testing easier because one module can validate multiple data access points of the software.

Discuss this Article

Post your comments
Forgot password?
    • Woman doing a handstand with a computer
      Woman doing a handstand with a computer