Introduction to MVC development

Source: Internet
Author: User

Part 1: traditional Web Development

In traditional web development, a page (using Dreamweaver or other tools) is designed first, and then the script code on the server is embedded in the page. Such as PHP, ASP, and JSP.

This is the style of PHP code (from joomla ):

This kind of development method can easily breed a kind of tendency: programmers who are used to it will mix a lot of business logic code and database access code into the page, making it difficult to understand. For example, the following PHP code (from WordPress): Some people have developed the framework, which forcibly specifies the location of various types of code. ASP. NET web form
It can also be regarded as a web development framework. It allows the business logic code or database access code to be put in the code behind (the post code, in general, you can certainly further separate)
For example, the following page and Its Post code (from blogengine): Post code: Part 2: MVC development method

The MVC development method for how to place code, there areStandard conventions. It is divided into three parts:

1. Page (view, also called view template)

2. Controller (the Controller obtains data and presents it to the view)

3. Model (model, domain model, responsible for providing database or data from its source)

The process of each part is as follows:

① The browser sends a request to the server

② The server finds the specified controller. The controller queries the model to obtain the data.

③ The Controller obtains the view and merges the model data and view (the dotted line indicates merging)

④ The MVC Framework returns the merged result to the client.

In essence, MVC is a code division method, which is not an architecture. It makes your code neat and orderly and more efficient.

Iii. Implementation of various MVC frameworks

There are many MVC frameworks, such as Microsoft's ASP. net mvc, wojilu MVC recorded (wojilu.com), struts in Java, and Ruby.
Rails.

The overall process of various frameworks is similar, but the implementation details and the richness of the provided tools are quite different. For example, wojilu MVC supports namespace and ASP. net mvc.
Only support area ......

After getting used to the MVC development method, you will feel that the entire process is not complicated at all. What is really complicated is the implementation of specific functions and services, investigation, sorting out requirements, design, performance tuning, and so on.

Iv. Features of wojilu MVC

1. Supports namespaces (make code files more clean and easy to view; Make layout and permission control easier to use );

2. By default, static files (JS, CSS, and images) are stored separately and can be easily switched to second-level domain names (separated application servers and static servers );

3. View logic and view template are completely separated;

4. The controller can easily rely on injection, and the Controller itself can also be customized through configuration;

5. html encapsulation is not supported, allowing front-end development to fully work at the HTML and CSS layers, with full control of HTML;

6. multi-language support (i18n), simple and easy to use;

Functions provided by other MVC frameworks, such as routing, filter, restfull URL, no page suffix, and style with better conventions than the configuration, it also provides comprehensive support for the expansion of various events in the page lifecycle.

Master the above features, need to see online tutorial http://help.wojilu.com/
. For more in-depth explanations, refer to the "my records" website's framework discussion area:
Http://www.wojilu.com/Forum1/Board/3

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.