MVC model and MTV model, MVC model MTV Model

Source: Internet
Author: User

MVC model and MTV model, MVC model MTV Model

MVC model:

MVC (Model View Controller Model-View-Controller) is a Web architecture Model that separates business logic, Model data, and user interfaces, allowing developers to decouple data and performance, front-end engineers can only change the page effect without accessing the back-end code. DBA can rename the data table and only change one place without searching and replacing a large number of files.

MVC divides web applications into three layers: models, views, and controllers. Loosely Coupled connection method, similar to plug-ins. This improves the code reuse capability.

 

MVC features unidirectional:

1. the browser sends a request

2. The controller interacts with the model to obtain data.

3. Controller call View

4. view rendering data and return

 

 

 

 

MTV model:

Unlike the Web frameworks in Rails, Spring, Laravel, and other languages, in Python, basically the MVC variant MTV (Model Templates View Model-template-View) is used)

Taking django's MTV as an example, MTV represents models, templates, and views respectively.

1. Model: like the MVC Model, it processes all data-related transactions: how to access, how to confirm validity, What behaviors are included, and the relationship between data.

2. Template: process performance-related decisions and display them on pages or other types of documents.

3. View: process the business logic. View is a callback function of a specific URL, which describes the data. Extract the corresponding data from the Model and call the relevant template. It is the communication function to be called by contorroller to implement control between the Model and View.

 

 

[Note] the objective of MVC and MTV is different:

The purpose of View in MVC is to present the data.

The purpose of MTV View is to display data.

Related Article

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.