Mvc,mvp,mvvm

Source: Internet
Author: User

Mvc

The MVC pattern means that the software can be divided into three parts
View: User interface.
Controller: Business logic
Model: Data saving

Practical projects tend to take a more flexible approach, taking backbone.js as an example.

    1. The user can send instructions (DOM events) to view, and the view directly requires Model to change state.
    2. The user can also send instructions directly to the controller (changing the URL to trigger the Hashchange event), which is then sent to the View by the controller.
    3. The Controller is very thin and only acts as a route, and the view is very thick and the business logic is deployed in view. Therefore, Backbone simply cancels the Controller, leaving only one Router (router).
Mvp

    1. The communication between the parts is bidirectional.
    2. View and Model do not contact, are passed through Presenter.
    3. The view is very thin and does not deploy any business logic, called the "Passive View" (Passive view), without any initiative, and presenter is very thick, where all the logic is deployed.
MVVM

The MVVM pattern renamed Presenter to ViewModel, which is basically exactly the same as the MVP model.

The only difference is that it uses two-way binding (data-binding): The change of view is automatically reflected in ViewModel, and vice versa. This pattern is used in both Angular and Ember.

Reference

1.http://www.ruanyifeng.com/blog/2015/02/mvcmvp_mvvm.html

Mvc,mvp,mvvm

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.