Service and DAO vs MVC

I am literally very new to Design Patterns , and I constantly come across words like ServiceLayers, DAOLayers, and Model-View-Controllersin programming.

Like StackOverflow , an extremely amazing platform that has a lot of extremely talented audiences when it comes to explaining concepts and / or logic.

I expect an elegant answer that explains the difference between all of these. When do we use them? When do we prefer the Service / DAO architecture over the MVC pattern? Do we have controllers in the Service / DAO architecture? What are the possible combinations in which we can integrate Service / DAO and Model / View / Controller.


This post will also be useful to everyone else who has the same doubts. Good posts should always be supported. Ask the moderators not to close this as a duplicate of any other question, since the question about SO cannot resolve my request.

+4
source share
2 answers

MVC returns to Smalltalk. Model-View-Controller usually means "user interface". The controller is a server-side component (for web applications) that accepts requests from View clients, updates the model accordingly, and sends the results back to all and all clients that need it.

/DAO . , - , View.

.

:

View ---> Controller ---> Service ---> Data Access Layer

.

-, REST. , .

.

, View Controller . . - , /, , .. - .

+1

DAO vs MVC

. DAO n- . MVC DAO.

- , -. - - , -API . , GUI/Client, - .

DAO - , .

MVC - , V C "" , M , (GUI). MVC . MVC.

Presentation Layer
  -> Views
  -> ViewModels  
  -> Controllers 

Service Layer
  -> Includes business logic
  -> Uses data access interfaces

Data Access Layer (DAOs)
  -> Contracts (interfaces) for persistent storage
  -> Interface implementations

Entities
  -> POCO/ POJO that represent data
+1

Source: https://habr.com/ru/post/1682965/


All Articles