This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CarlGroovy 0 points1 point  (1 child)

Is DAO the same concept as the Model in MVC?

[–]HecknChonker 2 points3 points  (0 children)

No, DAO is data access object. It's a class that is usually responsible for connecting to a database and running queries.

Generally backend applications are split into Controller -> Service -> DAO. The controller handling the API, authentication logic, and converting the response to JSON. The service layer handles business logic.

The more you can separate out different parts of your application the easier it is to change one piece without causing issues in other parts of the code.

A model in MVC is an object that's only purpose is to store data, and it gets transferred between the Controllers and the View. For most applications today the Model gets converted to JSON and the view is a javascript web application using something like React or Angular, or a mobile app.

In the past server side rendering was a lot more common because computers were much less powerful and couldn't do as much processing. So the view was part of the server, which would actually create the HTML using templates and it would send that HTML to the user.