This three-storey three-storey--mvc&ubd

Source: Internet
Author: User
Tags java web

After three years of learning programming, at this stage, begin to contact the architecture, start to understand the architecture, how to design a program structure, learn the name "architectural model" (architectural pattern), personal experience tells me this in the programming is a "quantity to qualitative change" of knowledge, no certain programming experience, Cannot talk about the structure. Don't say so much, I also just contact, talk about I know two kinds of architectural pattern.
Here is my mvc,ubd mode of some personal understanding, not necessarily correct, mainly used to organize ideas.

First, the general idea of MVC&UBD--cohesion well-structured classes poly, low coupling

Whether it's UBD or MVC, the program is simple or complex, and if you look at the three-tier architecture and MVC from a decoupling perspective, they're actually consistent.
Layer three: UI interface layer BLL business logic layer, DAL data access layer, Model entity layer
Mvc
M-Model (layer), mainly responsible for the business logic and database interaction
V view layer, used primarily for displaying data and submitting data
C is the controller (Controller) that is used primarily as a capture request and controls request forwarding

In accordance with the principles of design: Rely on the idea of inverted, to ensure that these three layers are closely linked, but are independent of each other, the changes within each layer does not affect the other layers. Each layer provides an external interface (INTERFACE), which is called at the top level. As a result, the software can be modularized, modify the appearance or change the data without modifying other layers, greatly facilitate maintenance and upgrades.



Ii. Simple understanding of MVC

The

 mvc is a model proposed in the BS project. It's a three-storey one. have been doing DRP projects recently, understanding of MVC is based on Jsp,servelet, Dal to understand. The
          First V is view, view, which is directly oriented toward end users. It is provided to the user's operating interface, is the shell of the program. Don't explain too much.
 
        Second is controller, which is what the controller means, the so-called controller, which forwards user requests to the model layer, After processing the results returned to the interface to show an intermediate layer, then controler exactly what work.
  First take a look at the three-tier definition in the Java Web, typically in the Java web, where JSP acts as v,servlet as C,javabean as M, and the servlet here does what it does. Accept input, go to the model layer to process, processing results are saved to forward to the JSP, and then show the data. So its function is the basic function of the controller, it is the tube forwarding, between V and M.
 
         again, M, model, in the Java Web says Javabean,javabean is not just an entity, It also contains classes for business logic and database operations, which are completely different from entity classes. Includes business logic and data access.
 
 
Second, UBD mode and MVC pattern comparison

 1, partitioning:
   three tiers are based on business logic, and MVC is based on the page. This is felt in the DRP, and the servlet is closely associated with the JSP.
  
 2, scope
 
   Three layer feel more like a macro architectural pattern three layer is an idea, on which we may extend four layers of five layers, Are changes that are made according to the business. MVC is an application model for dealing with BS projects. Because MVC in model contains the business logic layer, the data operation layer, the division here is actually a three-storey miniature embodiment.
  
 3, top-heavy
 
 mvc give me the feeling that this is the need to focus on model. The typical model layer in layer three is composed of entity classes, while MVC is composed of bll,dal,model in three layers. Not the same concept, though the name is the same. The gold content of the model in the
 mvc is extremely high.
 
  for the time being. The study of MVC continues.

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.