The similarities and differences between the three-tier architecture and MVC architecture of Web projects

Source: Internet
Author: User

Http://www.cnblogs.com/zhhh/archive/2011/06/10/2077519.html

I also see someone asking about the three-tier architecture and the MVC relationship, which is a bit of a dogma. Because they all logically put the application into three blocks, rounding up a number 3, someone has to link them together.

These two things I touch for several years, have a little experience, Express:

Layer three is layer three, MVC is MVC, they have nothing to do with it.

layer Three is a layer of three from the perspective of the entire application architecture (and can be layered if the program requires it).

Layer three is designed to solve the problem of code encapsulation at different stages of a business operation throughout the application, in order to enable programmers to focus on the business logic at a particular stage.

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

MVC is a few modules of different functions that are divided in the view layer of the application (BS structure).

MVC is mainly to solve the application user interface style substitution problem, the Display data HTML page as far as possible and business code separation. MVC separates the Pure Interface presentation logic (user interface) into some files (views), puts some program logic (Controller) that interacts with the user in a few files, passes the data in views and controllers and uses some entity objects that specifically encapsulate the data. These objects, collectively referred to as models.

Only so MVC has nothing to do with layer three because they use different scopes: three layers can be applied to any language, any technology application, and MVC is just to solve the coupling of the parts of the BS application View layer. They are non-conflicting, can exist at the same time, and can be used depending on the situation.

http://blog.csdn.net/beijiguangyong/article/details/7029257

Three-tier architecture is mvc!

At first, the teacher always said three layer Mvc,mvc three layer architecture ...

So the beginning of the brain is a concept: Layer three is Mvc,mvc is a three-tier architecture. And it's reasonable to think about it, it's all "three". MVC is a three-letter, three-tier architecture is also "three", and rightly so on the corresponding. And then it's been "wrong" for a long time.

The three-tier architecture is by no means mvc!!

After studying the Java EE, I found that the teacher said that it seems wrong, MVC and three-tier architecture is not a thing. The three-tier architecture is composed of the interface layer (UI) business Logic Layer (BLL) and the data Access Layer (DAL), which is composed of the model layer (M) interface layer (View) and the control layer (Controller), and they do not correspond to each other.

If it is hard to give them a match, then the UI in the three-tier architecture corresponds to the view (JSP) in MVC, which is used to display and get the data for the interface. The BLL layer and the DAL layer in the three-tier architecture correspond to the model (JavaBean) layer in MVC, which is used to process the data passed from the upper layer and the data obtained from the database; the controller (Servlet) in MVC is part of the UI in the three-tier architecture, What we often talk about is the servlet.

As shown in the following:

Suddenly feel the world is clear, on the stratification and in-depth understanding of a step.

In fact, three-tier architecture and MVC is still a thing!!!

The last few days have been thinking about what is the relationship between the three-tier architecture and MVC, and why did the teacher put it together at first? Then suddenly realize: in fact, three layer architecture and MVC is the same!!! What we see is not the same as it is on the surface. The core thing is the same, then what is the core?

Answer Yue: layering, decoupling!

If you look at the three-tier architecture and MVC in terms of decoupling, they are consistent, but the partitioning method is different, as shown in the figure above. From this point they can be said to be a thing. This is equivalent to the way we see steamed buns and noodles, on the surface they are not the same (note only the surface) but their core is consistent, are face ...

The learning process of knowledge will be like the old cow chewing, need to continue to deepen the understanding, in the end to truly understand

The understanding of things from perceptual to rational, is a step by step deepening, each step of deepening may overturn the former self, may be more agree with the former self. If it is to overthrow the former self, then the understanding of this thing has happened to change the world, but if the approval of the previous self also does not mean that their views have not changed, often seemingly consistent on the surface of something actually the kernel and must be the same. Just like when I first thought that the three-tier architecture and MVC were a thing to the end and that the two were a thing, but the level of understanding was definitely different.

As for the future will not overturn their views I do not know, can only say that each overthrow represents progress, represents a deeper understanding of the layer, so I look forward to the next rejection of their

Http://baike.baidu.com/view/687468.htm

The difference between MVC and MVC (model model-view view-controller controllers) is a design pattern that we can use to create a distinction between a domain object and a UI presentation layer object.

The same architecture level, the same thing is that they all have a presentation layer, but they are different in the other two layers.

The concept of a controller is not defined in the three-tier architecture. This is the most different place I think. and MVC does not consider the logical access of the business as two layers, which is the main difference between a three-tier architecture or an MVC build program. Of course. The model is also mentioned in layer three, but the concept of model in the three-tier architecture is not the same as the concept of model in MVC, and the typical model layer in the "three layer" is made up of entity classes, while MVC is composed of business logic and access data.

Http://topic.csdn.net/u/20090710/14/07f4447d-60c4-4b74-af1c-ea1b6e2e9ca7.html

Of course, you have to understand the differences and linkages between the MVC three-tier architecture:
The three-tier architecture is the most basic project layering result, and MVC is a variant of the three-tier architecture, and MVC is a good development model. First, you need to understand what MVC means, respectively. M, the model layer, is primarily responsible for the business logic and the interaction of the database V, the view layer, primarily for displaying data and submitting data C as Controller (director), primarily as a capture request and to control request forwarding
Layer three: UI interface layer BLL business logic layer, DAL data access layer, model entity layer MVC in the M is not the model (entity layer) in the three layer, he actually includes three layers of Bll,dal,model, which is very important to note, this is the difference between them is the key
Some of them are as follows: Low coupling, high reusability and low applicability life cycle costs Rapid deployment maintainability facilitates software engineering management
Of course, the advantages also have shortcomings, that is, the internal structure is complex, not easy to understand, the number of documents, management difficulty naturally also big

MVC design Pattern ... Three-tier architecture ... What they get after segmentation is that the View (UI), BIZ (BLL), DAO (DAL), Entity (Model), Controller MVC unify the BIZ (BLL), DAO (DAL), Model (entity) asmodel, get: View, controller, model three layer in my use, I do not realize the existence of the controller, is completely: UI, DAO, BLL
They have the same design philosophy: Separating the view design from data persistence, which reduces coupling, is easy to scale, and improves team development efficiency.

Layer three is based on business logic, and MVC is based on the page to divide the fundamental there is no comparability. Actually, I feel good with both of them.

MVC pattern is a composite design pattern, a solution three layer is a software architecture, through the interface to achieve programming three-layer mode is the architecture pattern, MVC is the design pattern three-tier mode and can be attributed to the deployment mode, MVC can be attributed to the representation mode

Quote landlord daijun17 reply: How to choose between three-tier architecture and MVC?

There is no choice but to say is not the same thing at all. In the so-called "three layer", it requires you to separate the BLL layer, which simply tells you the static relationship between the presentation layer and the business logic layer. And MVC tells you how to deal with its dynamic driving process in this particular place, even though MVC is still rough (even the MVP is rough), but it's more nuanced than the so-called three-story.

Thank you for your attention, these days are busy with the interview, did not come to knot paste. Thank you again. I probably understand: the three-tier architecture and MVC design pattern are different, the three layer is a general architectural idea, there is no limit to the specific design, and MVC is more specific to explain its design methods. Or do it yourself, understanding will be deeper, used to be a three-tier approach to architecture

---------------------------------------------------------------------------------------------------------------

http://apps.hi.baidu.com/share/detail/15057889

The difference between ASP. NET MVC and WebForm three-tier architecture

1. Some problems existing in the development of traditional WebForm

In the traditional ASP. NET development, Microsoft's development team designed a rapid development environment for developers to drag and drop controls in a visual designer and write code to respond to events. However, the negative effects it brings are:

Because the control encapsulates a lot of things, it's hard for developers to understand how the HTML behind it works.

Easy to get a page with a large number of viewstate, so that the page size far beyond the required content, making the page open slowly

Not easy to be tested

2. What is MVC?

MVC (Model-view-controller, model-View-controller mode) is a software architecture model in software engineering. It divides the software system into three basic parts: model, view, and controller.

3. What is asp. NET MVC?

ASP. NET MVC is an easy-to-test framework developed by Microsoft's development team based on MVC. It has the following characteristics:

No data callbacks

View state is not saved in the page

Developers have full control over the rendering process of the page

Easy Unit Testing

Easy test-driven development

Extensible, replaceable

Support for features in WebForm, such as: User controls, master pages, data binding, localization, and more

is not based on the file directory structure, but instead maps the URL to the controller

4. why is ASP. NET MVC used?

Easy to Unit test

Easy to test-drive development

Avoids the large number of ViewState in WebForm causing the paging file to become bloated

5. MVC and three-tier architecture ?

MVC is a pattern. asp. NET MVC is a development framework based on the MVC pattern three-tier architecture is an architecture

As for the difference, it can be strictly separated from the concept.

is the correspondence between MVC and the three-tier architecture

6. How does MVC and WebForm choose?

7. Two kinds of technology coexist

The ASP. NET MVC framework is just a choice for developers to develop Web applications, not to replace WebForm

Each of these two technologies has advantages and disadvantages, developers need to choose the corresponding technology according to the actual situation

Sometimes, you can mix the two technologies in the same project

Architecture diagram of 8.asp.net MVC and WebForm Technology

Summarize:

After reading this article, I believe that the choice of ASP. NET WebForm and ASP. I believe that we should be able to do well, I always feel that many times is not a good technical problem, but suitable for not suitable for the problem or whether it can be used well.

For example: If the Maxima plow, I am afraid that may not be able to achieve the desired results, and eventually might complain, what a broken horse, not a bit of strength.

========================================================================

Http://www.blogjava.net/phyeas/archive/2008/07/01/211995.html

At the same architecture level, what are the similarities and differences? This article discusses their similarities and differences. Hope to help readers understand the mystery. :)

In fact, they all have a presentation layer.

But they are different in the other two layers.

Let's first explain MVC. V is view. Is the meaning of views. C is controler. Is the controller's meaning. and M is the model, the meaning of the models. These three. The most difficult to understand is the model. What is model, and why it is called model. Let me not say why the model, first explain controler.

Controller is the meaning of controllers, the so-called controller, is to forward the user request to the model layer, after processing the results back to the interface to show an intermediate layer, then controler exactly what the work of the tube? Let's not talk about it first. In the Java Web, the general definition of these three layers, generally in the Java Web, JSP acts as a v,servlet to act as C,javabean, where the servlet tube what work? Accept the input, go to the model layer to process, the processing results are saved and forwarded to the JSP, and then show the data. So its function is the basic function of the controller, it is the tube forwarding, between the V and M.

In other words, M, model, in the Java Web is said to be javabean, I know a lot of people who mistook JavaBean as an entity class, in fact JavaBean has a richer definition than the entity class, in the JavaBean in addition to its properties and fields, there can be behavior and its events , JavaBean can be understood as plain Java objects. Java generic objects, which are all objects that conform to the Java specification, are completely different from entity classes. So, I think in MVC. Business logic and data access should be placed on the model layer, that is, V is responsible for presenting the data, controler not doing business logic except forwarding. Real logical transactions, data access, and even algorithms are put into the model.

Let's talk about the three-tier architecture. Three layers in fact very good understanding, interface, business, data access, on these three, literally can understand their meaning. What I'm talking about is the difference between it and MVC. The concept of controler is not defined in the three-tier architecture. This is the most different place I think. and MVC does not consider the logical access of the business as two layers, which is the main difference between a three-tier architecture or an MVC build program.

Of course. The model is also mentioned in layer three, but the concept of model in the three-tier architecture is not the same as the concept of model in MVC, and the typical model layer in the "three layer" is made up of entity classes, while MVC is composed of business logic and access data. Not the same concept. Although the name is the same.

Http://blog.sina.com.cn/s/blog_677b66170100mv16.html

ASP. NET MVC and three-tier architecture linkages and differences

First of allMVCand three-tier architecture, is not the same. In a three-tier architecture, the DAL (data access layer), the BLL (business Logic Layer), and the Web tier perform their duties to separate responsibilities.MVCIs Model-view-controller, strictly say that these three add up later is the three layer architecture of the web layer, that is,MVCThe web layer in the three-tier architecture is differentiated again, divided into the controller, the view, the entity three parts, the controller completes the page logic, through the entity to complete the call with the interface layer, and the C layer directly with the three layer of the BLL dialogue. So. NETThree-layer structure, there is no action concept.ASP . NET MVCis a new website development architecture that Microsoft has released. In order to solve the traditionalASPIt is not designed to separate model,view and controllers in development. In order to solve the problems of portable, maintainable and extensible, the Web site will be designed into three separate modules, the model is responsible for the database part, the view is responsible for the interface of the Web page, and the controller is responsible for interface and data interaction and business logic, This design of the site if you want to design or re-develop a module for the other modules is not affected. ButASPThe page background code is one by one corresponding to each page code, and the business logic is inevitably written in the background code associated with the view in some cases.   This will not guarantee the separation of the view and controller, it is difficult to implement the site rewrite and upgrade. And inMVCThe page code is not corresponding to the background code one by one, but is stored as controller and view two parts, completely resolved, view and controller can not be independent of the problem.   This improves the process of rewriting and upgrading the site. ButMVCAlso has its drawbacks, because server controls are no longer available in the page code, so someASPThe use of server-side controls has caused trouble, andMVCThe design of the page also brings a lot of obstacles.ASP . NET MVCis a new website development architecture released by Microsoft in April 2009, Http://msdn.microsoft.com/en-us/library/dd394709.a SPX, which is the traditional sense ofMVCThe idea of development was integrated intoASPDevelopment.   So let me also talk about my understanding of both. First of all on this topic, itself is problematic, "XX structure" and "xx mode" difference?   What is the difference between Chinese social system and American way of life? The two themselves are talking about different directions and angles, and in practical applications they do have some similar characteristics, in manyBooksAlso did not explain in depth, so as to cause confusion, in order to better understand them, let's say the difference. First n-tier structure is a software abstraction hierarchy, is a vertical segmentation of complex software, each level to complete the same type of operation, so that the various code with its completion of the mission as the basis for segmentation, in order to reduce the complexity of software and improve its maintainability. In general, the hierarchy is down-to-bottom, the underlying code is not determined by its interface (contract), the upper layer of code is not developed, the underlying code interface (contract) changes will make the upper layer of code changes together. The three-layer structure is a kind of n-layer structure, which is an application-wide n-layer structure derived from the long-time use of human, which is widely circulated and even written in textbooks as a typical software hierarchy.MVCA pattern is a composite design pattern, a solution that can be repeatedly practiced to solve a practical problem in a particular situation. Coincidentally, he also has three things, so people have a kind of the corresponding relationship: Display layer-view; business logic layer-control; persistence layer-model. First of allMVCThere is no obvious hierarchy between the three things, there is no obvious downward dependency, instead, the view and model are often relatively independent, and control is the bridge between the two, they are more like horizontal slicing. This results in a result,MVCEach block can be tested independently, and in a three-tier structure, the upper module runs tests that provide lower-level code or piles that provide the same interface. Relatively speaking,MVCMuch more complex, but with clearer structure and lower coupling. Other than thatMVCEach piece inside, especially the model interior, is often designed to be multi-layered. In my opinion of a goodMVCIn the structure of pattern building, control is the core, small and stable, can be provided as a core framework, there are extensibility points, but basically can be easily configured to run without any code. The view may be a set or a variety of alternative views engine, determines the software presented to the interface, the use of the main workload is the extension point and the number of different view templates as needed. Model is a business provider, which determines the functionality provided by the software, the internal may be some ordinary class or the implementation of certain interfaces of the class, in which may be different from the business color, for complex software may be divided into many layers, such as the business Logic layer, the service provider layer, the system provides layer, the data supply layer   , data access layer, and so on. I often use metaphorsMVCThe example is the kind of cassette game machine played in childhood, control is the host, generally I buy a host on the line, as long as he is not bad, he can always let me play this kind of game. The view is the TV and the game handle, the television can work independently, he regardless of input is the television signal, the DVD player signal or the game console signal, he just displays, and he decides how we see the effect is how, if I want a bigger or the color display effect, I just need to buy a corresponding TV on the line, the handle is also can be changed, to the remote pole or with vibration. The model was a game cassette, and he had to decide what game I was playing, whether it was the bucket or Super Mary, and the console and the TV maker never knew what kind of game it might run on.   There may be game codes and storage units in the cassette, which are designed according to the needs of the game. Some friends refer to the interface of the cassette slot provided by the game host, in the design, sometimes also by the control provides a set of interfaces for the model or view implementation, thus forming a dependency. In general, this design is not too big problem, but will increase the coupling between the modules, but also bring some intrusion. In order to be more perfect, you can use the interface to provide the contract, can be used configuration information (or metadata information) + reflection to provide the contract, then this class interface can be degraded to as long as CLS-compliant, that is, ordinary class, like the current computer interface widely used USB, whether it is a USB flash drive, printer,   Scanners or dongles, they're all normal USB devices. Referring to the USB has a digression, the module's pluggable design or even hot-swappable design, the system can not stop the operation of the dynamic mount or remove the module, the dynamic Mount module requires the system to automatically discover new modules and according to the self-described information automatically configured, remove the possibility of a more complex, need to "   Safely Remove Hardware "features similar to this. Many scenarios are considered when designing broadly reusable frameworks to achieve greater adaptability, and applications in general projectsMVCMode can be more casual.

The similarities and differences between the three-tier architecture and MVC architecture of Web projects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.