What is the difference between DAL, DTO and DAO in the style of three-tier architecture, including MVC

I recently learned about ORM (Object Relational Mapping) and the three-tier architecture (presentation, business, and data storage ). If I understand correctly, I can highlight the level of data storage in DTO and DAO.

I would like to understand how the following parts work together at the data retention level.

  • DAL (Data Access Level)
  • DTO (data transmission object)
  • DAO (data access object)

At the top of this, I found out that

In larger applications, MVC is a presentation layer of only the N-level architecture.

I really got confused how this can even be possible, for example, in the style of a three-tier architecture, where MVC is just the presentation layer, and DTO, DAO, DAL are just part of the data storage layer. I am completely lost.

I would be glad if someone tells me the truth about how this works together.

Please do not close this question, because many different expressions that I have seen everywhere, these things are related to each other mainly in large applications, and I can not imagine how this works.

I appreciate any answer!

+6
source share
1 answer

Let's start with each goal: -

DTO

Data Transfer Objects. They are commonly used to transfer data from the controller to the client (JS). The term is also used for POCOs / POJOs by several that actually store data retrieved from the database.

DAO

A data access object is one of the design patterns used to implement DAL. This creates and executes queries in the database and displays the result in POCO / POJO using various other templates, including "Request Object", "Data Map", etc. The DAO level can be further expanded using the Repository template.

DAL

The data access layer abstracts your database activity with DAO / Repository / POCO, etc. ORMs help you build your DAL, but it can be implemented without using them.

MVC

Model View Control is a template that is used to separate the presentation (presentation) of business logic. For MVC, it doesn't matter if DAL is implemented or not. If DAL is not implemented, the database logic just goes into your model, which is not a good approach.

In larger applications, MVC is a presentation layer of only the N-level architecture.

Models consume most of your business logic, as described above. In an N-tier application, if the business logic is completely separated for reuse in applications / platforms, then models in MVC are called anemic models. If BI does not need to be reused at this scale in your application, you can use the model to store it. No confusion, right?

I would be glad if someone tells me the truth about how this works together.

All MV * patterns define only an idea / concept; they do not define an implementation. MV * models mainly focus on the separation of views from BI. Just focus on that.

Refer to this for information on various objects containing data.

+6
source

All Articles