Similarities and differences between the three-tier architecture of the Web project and the MVC architecture

The three-tier architecture is composed of the interface layer (UI), business logic layer (BLL) and data access layer (DAL)

The MVC is composed of the model layer (M), the interface layer (View) and the control layer (Controller)

The three-tier is the three-tier from the perspective of the entire application architecture (if the program requires it, it can also be divided into multiple layers).

  The third layer is to solve the problem of code encapsulation at different stages in each business operation process in the entire application, in order to make programmers more focused on the business logic of a certain stage.

  For example, the database operation code is encapsulated in one layer, and some methods are provided to directly return the corresponding data required by the user according to the parameters, so that when dealing with specific business logic, there is no need to care about the data storage problem.

MVC is divided into several modules with different functions in the view layer of the application (BS structure).

  MVC is mainly to solve the problem of replacing the style of the user interface of the application, and to separate the HTML page that displays the data from the business code as much as possible. MVC separates the pure interface display logic (user interface) into some files (Views), puts some program logic (Controller) that interacts with the user in some files separately, and transfers data in Views and Controller using some specialized encapsulated data The entity objects, these objects are collectively referred to as Models.

  I just say that MVC has nothing to do with the three layers because they have different ranges of use: the three layers can be applied to applications of any language and any technology; and MVC is just to solve the coupling relationship between the various parts of the BS application view layer. They do not conflict with each other, they can exist at the same time, or one of them can be used according to the situation.

Guess you like

Origin blog.csdn.net/m0_37541228/article/details/77337796