MVC framework with the similarities and differences between the three-tier

2009-09-06  来源:本站原创  分类:Java  人气:222 

Is also the schema level, they have any similarities and differences point? This article discuss the similarities and differences between them. Hope to help the reader understand the abstract possibilities. :)

In fact, they are the same place is that they have a presentation layer.

But they differ is on the other two layers.

First of all first explain the MVC. V that the View. Is the view of meaning. C or Controler. Is the controller means. The M that Model, the model mean. These three years. The most difficult to understand should be the Model. That is what is Model, and why is called Model. Why I will not speak, I called Model, to explain Controler.

Controller is a controller, the meaning of the so-called controllers, that is, the user forwards the request to the model layer, after proper treatment the results back to the interface exhibited a middle layer, then the Controler in the end tube about it? I will not speak. The first run under the Java Web in the general definition of these three layers, generally Java Web-ri, JSP as V, Servlet as C, JavaBean as M, where Servlet tube about it? Accept the input, go to the Model layer to deal with, and the results saved, forwarded to the JSP, and then display the data. So its function is to control the basic functions, it will control forward, in between the V and M rove.

Come to talk about M, namely Model, in the Java Web speaks of JavaBean, I know a lot of people put the JavaBean mistaken for an entity class, in fact, JavaBean richer than the definition of an entity class, in the JavaBean properties and characters in addition to its section, you can also have behavior and events, JavaBean can be understood as an ordinary Java objects. Java common objects that meet the Java specification of all objects, which is completely different classes and entities. So, I think in the MVC in the. Business logic and data access should be placed in Model layer, that is, V is responsible for displaying data, Controler In addition to forwarding not do business logic. The real logic of services, data access, and even algorithms are to go into the Model.

Besides three-tier architecture. Is actually very good understanding of three-layer, interface, business, data access, on these three, can be understood from the wording out of their meaning. I would say is that the difference between it and the MVC. In the three-tier architecture is not defined Controler concept. This is I think the most different places. The MVC did not consider the business logic to access as two layers, which is used to build three-tier or MVC main difference between procedures.

Of course. Also referred to the three-tier Model, but the three-tier architecture Model concept and the concept of MVC in the Model is not the same, "three" in the Model layer is a typical entity class has been formed, while the MVC, it is business logic and access data from the composition. Not the same concept. Although the name implies.