Загрузка страницы

The DAO Pattern in Java | Data Access Object Design Pattern

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-servlet-jdbc-mysql-crud-tutorial

Blog post at https://www.javaguides.net/2019/03/jsp-servlet-jdbc-mysql-crud-example-tutorial.html.

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

Видео The DAO Pattern in Java | Data Access Object Design Pattern канала Java Guides
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
12 февраля 2020 г. 8:50:53
00:12:51
Яндекс.Метрика