Differences between the mvc model and the mvc framework.

Source: Internet
Author: User

Differences between the mvc model and the mvc framework.

There are too many new names in Spring! IOC/DI/MVC/AOP/DAO/ORM...

For me who just got in touch with spring, I did get dizzy! But once you have mastered a concept, it will serve you with all your heart and soul. This is more loyal than women.

Here, let's look at MVC! Well! The difference between the MVC design model and the MVC framework.

A group of concepts must be understood first, because the following concepts need to be used:

Architecture: Simply put, architecture is a blueprint. It is a design scheme that abstracts different customer needs into abstract components and can describe the communication and call between these abstract components.

Framework: A Software Framework is an architecture formed by extracting the common parts of software in a specific field in the Project software development process. software projects in different fields have different types of frameworks. The framework is not a ready-to-use application system. It is a semi-finished product that provides a lot of services, and developers conduct secondary development to implement specific functions of the application system.

Design Pattern: it is a set of summaries that are repeatedly used, known by most people, classified and catalogued, and code design experience. It emphasizes a solution to design problems.

 

First, let's talk about the MVC design model:

1. Definition: the MVC design Model is a pattern that uses Model View Controller (Model-View-Controller) to design and create Web applications.

It can be easily seen from the above-mentioned objects that the mvc model is a style used to write web applications. That is to say, it can only be written to the web and cannot be written to others?

2. SinceWhen Model View Controller (Model-View-Controller) is used, it is necessary to introduce what the Model-View-Controller is like?

 

Model: A Model that is used to process the data logic of an application. Typically, model objects are used to access data in databases.

 

View: displays the processed data in an application.
Generally, a view is created based on model data.

 

Controller: a part of an application that processes user interaction.
Generally, the Controller reads data from the view, controls user input, and sends data to the model.  Let's talk about the MVC framework: 1. MVC Framework, which forcibly separates application input, processing, and output. MVC applications are divided into three core components: model, view, and controller. They process their own tasks. As we can see from the above, to use the MVC framework, we must abide by the rules of the framework, it has its mandatory. Smart readers can see at a glance that the three core components used are actually from the MVC model. In the framework, they are more independent from each other to process their respective tasks. 2. The most typical MVC is the JSP + servlet + javabean mode. 3. View: view is the interface on which the user sees and interacts with it. The view mainly includes HTML, Adobe Flash, XHTML, XML/XSL, WML, and other identification languages and Web services.

Model:The model represents enterprise data and business rules.

Controller: Control The Controller accepts user input and calls models and views to fulfill user requirements. Therefore, when you click a hyperlink on the Web page and send an HTML form, the controller does not output or process anything. It only receives the request and determines which model component is called to process the request, and then determines which view is used to display the returned data. Differences between the design model and the framework: (note that the general concept is discussed first !)

Let's take a look at the differences provided on the Internet, from Baidu Encyclopedia:

There are three levels of reuse in software production: Internal reuse (that is, abstract blocks that can be commonly used in the same application), and code reuse (that is, combining common modules into libraries or tool sets, so that it can be used in multiple applications and fields), and the reuse of Application Frameworks (that is, providing general or ready-made infrastructure for specialized fields to achieve the highest level of reusability ).

The framework is usually code reuse, while the design pattern is design reuse (? How does design reuse come from? It is not defined in the upper and lower layers. Encyclopedia garbage is here .), The architecture is between the two.

The design pattern is a description of the problem that occurs repeatedly in a certain environment and the solution to the problem. It is more abstract than the framework. The framework can be expressed in code and can be directly executed or reused, for patterns, only instances can be represented by code. design patterns are smaller elements than frameworks. A framework usually contains one or more design patterns, the framework always targets a specific application field, but the same pattern can be applied to various applications. The framework is software, and the design pattern is software knowledge.

Encyclopedia answers are often not rigorous. I saw on the MBR lib website that they classify software reuse as: Product reuse/knowledge reuse/environment Reuse.

The framework is code reuse, so we always introduce many packages when using the framework.

The framework is software, while the design model is the "knowledge" of software ". Therefore, pattern is the basis of the framework.

 

Return to the small concept of MVC:

According to the big concepts of the framework and design pattern, we should be able to know the differences between the MVC Framework and the MVC design pattern.

In my understanding, I think the MVC design pattern is more like the drawing in the designer's hand (the drawing is often more abstract ), the MVC framework is more like a product built by engineers on designer drawings!

The final product may be different from the original drawing of the designer. Some functions are enhanced, and some are weakened as appropriate to better adapt to the needs and experience of the masses! However, they follow the designer's structure on the whole and in essence.

The MVC design pattern is like the foundation of building a house (foundation design + structure design + strong and weak current design + fire protection design + etc), while the MVC framework can be built based on the needs of beautiful finished rooms.

  Common frameworks and design models (note that this is a big concept)

 

What are the design patterns?

 MVC, MTV, MVP, CBD, ORM, etc;

 

What are the frameworks?

 QT, MFC, and gtk in C ++

SSH and SSI in Java Php smarty (MVC mode) Django (MTV mode) in python;

 

Reference: Framework + architecture + design mode;

 

 

 

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.