The DAO Pattern in Java | Data Access Object Design Pattern

Veröffentlicht am: 11 Februar 2020
auf dem Kanal: Java Guides
77,510
854

In this video, we will learn the DAO (Data Access Object) design pattern with an implementation example.

Data Access Object or DAO design pattern is a popular design pattern to implement the persistence layer of Java application.

The Data Access Object (DAO) pattern is a structural pattern that allows us to isolate the application/business layer from the persistence layer using an abstract API.

Source code on my GitHub repository: https://github.com/RameshMF/jsp-servl...

Blog post at https://www.javaguides.net/2019/03/js....

Advantages of DAO pattern
-------------------------------------------------------------------

1. While changing a persistence mechanism, the service layer doesn’t even have to know where the data comes from. For example, if you’re thinking of shifting from using MySQL to MongoDB, all changes are needed to be done in the DAO layer only.

2. DAO pattern emphasis the low coupling between different components of an application. So, the View layer has no dependency on the DAO layer and only the Service layer depends on it, even that with the interfaces and not from concrete implementation.

3. As the persistence logic is completely separate, it is much easier to write Unit tests for individual components. For example, if you’re using JUnit and Mockito for testing frameworks, it will be easy to mock the individual components of your application.

4. As we work with interfaces in the DAO pattern, it also emphasizes the style of “work with interfaces instead of implementation” which is an excellent OOPs style of programming.

#designpatterns #java #javaguides


Auf dieser Seite können Sie das Online-Video The DAO Pattern in Java | Data Access Object Design Pattern mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Java Guides 11 Februar 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 77,510 Mal angesehen und es wurde von 854 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!