D
D
DollyPapper2021-08-12 14:07:49
PHP
DollyPapper, 2021-08-12 14:07:49

Differences between MVC and Three Tier?

Hello. The question is the following. I started to disassemble the three-level architecture for myself, I did not understand what is its fundamental difference from MVC, and as it turned out, I also do not understand MVC correctly.
In the classical three-link, the structure is linear, BLL and PL never directly communicate with each other. I think the same about MVC. Take for example Yii2 and how I usually write. View sends the request, it is processed by the controller, which retrieves methods in the model, it prepares something, gives the result to the controller, and it renders a new view through render or in some other way, for example, sends data to the client through rest requests, that is, updates the view . And here I don’t see any differences for myself between MVC and three tier. However, I went to SO to look for these differences and heard such a thing



The main difference between both is:

A three tier architecture is the client tier never communicates directly with the data tier In a Three-tier model all communication must pass through the middle tier

MVC architecture is triangular: the view sends updates to the controller, the controller updates the model, and the view gets updated directly from the model


And indeed, if you look at the diagram in the same Wikipedia 240px-MVC-Process.png
From the model, we see an arrow with Update that goes to View. That is, for example, everything with the same example from Yii, to be more specific, the render method needs to be called on the model in order to follow the MVC pattern?

UPD: how I see MVC for myself now (although it may be a hybrid between Tier 3 and MVC)
611503d1ad7ab167907810.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
@
@insighter, 2021-08-12
_

Maybe you shouldn't be so meticulous about the issue?
MVC is a programming pattern for separating data and visualizing that data.
A three-link, if very simplified, means that working with data does not go directly with the DBMS server, but through some intermediate layer, which most often introduces its own abstractions.

D
Dmitry Belyaev, 2021-08-13
@bingo347

MVC does not consider the data layer at all, but separates the client layer into View (what we show to the user, for example, HTML and CSS on the web, as well as their change over time) and Controller (external event handlers, mouse clicks, keyboard presses, requests from the outside) .
Model (business model, how business rules are reflected in the code, in fact, this is the logic) really coincides in essence with the logic layer.
The data layer is not expressed in MVC, but it is useful, because you really don’t need to mix the domain with the details, and working with data (database, files, external APIs) are details that are more subject to change over time than business rules. So by separating this layer, we invest time in the future, simplifying software support in the future.

V
Vladimir, 2021-08-19
@v__V__v

In my opinion, these are just different representations of the same thing. If we mentally overlay a transparent image of the layers of the Three Tier model on MVC, then in the data layer we will have a piece of the model responsible for queries to the database, their structure, etc., in the logic layer the remaining piece of the model + controller that provides business logic and everything related to it, and in the client layer, the view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question