This three-layer non-three layer--MVC&UBD

Source: Internet
Author: User

Studied three years of programming, to this stage, began to contact the architecture, began to understand the architecture, how to design a program structure, learning the name "architecture pattern" (architectural pattern), personal experience tells me that in programming is a "quantitative to qualitative change" of the knowledge, no certain programming experience, is not talking about the architecture. Do not say so much, I also just contact, talk about I know the two architectural patterns.
Here are some of my personal understanding of the MVC,UBD model, not necessarily correct, mainly used to organize ideas.

First, the general idea of MVC&UBD--cohesion, low coupling

  whether it's UBD or MVC, the program is simple or complex, If you look at the three-tier architecture and MVC from a decoupled perspective, they are in fact consistent.
  Layer Three: UI interface layer BLL business logic layer, DAL data access layer, model entity layer
 MVC
  m (model layer), mainly responsible for business logic and database interaction
  v, the view layer, is used primarily to display data and submit data
  c, the controller, primarily as a capture request and to control request forwarding
 
  According to the principle of design: rely on the idea of reversal, to ensure that the three layers are closely linked, but are independent of each other, the changes within each layer does not affect the other layers. Each layer is externally provided with an interface (Interface) for invocation on the above layer. In this way, the software can be modular, modify the appearance or change the data without modifying the other layers, greatly facilitate maintenance and upgrade.
 
 
   
Second, MVC simple understanding

 MVC is a model presented in the BS project. It's a three-storey one. I've been working on the DRP project recently, and the understanding of MVC is based on Jsp,servelet, the DAL.
          First V is view, which is the view layer that is directed towards the end user. It is provided to the user's operating interface, is the shell of the program. Don't explain too much.
 
        Next is controller, which means that the controller is to forward the user request to the model layer, After processing, the results are returned to an intermediate layer shown in the interface, so what does Controler do?
  First Look at the Java Web, these three layers of the general definition, 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.
 
         again, the model, in the Java web, says that Javabean,javabean is not only an entity, It also contains classes for business logic and database operations, which are completely different from entity classes. Contains business logic and data access.
 
 
Second, UBD mode and MVC mode comparison

1. Division:
Layer three is based on the business logic, and MVC is based on the page to divide. This is achieved through the DRP, and the servlet is closely linked to the JSP.

2. Scope of Action

Three layers feel more like a macro architecture pattern three layer is a kind of idea, on this basis, we can expand has four layer five layer, are according to the business to make the change. MVC is an application pattern in the processing of BS projects. Because MVC in the model contains the business logic layer, data operations layer, here is actually a three-storey miniature embodiment.

3. Top-heaviness

MVC gives me the feeling that this is the way to look at the model. " The typical model layer in layer three is made up of solid classes, while MVC is made up of three layers of bll,dal,model. Not the same concept, though the name is the same.
The gold content of model in MVC is very high.

For the time being the sentiment. Learning about MVC is continuing.



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.