Take notes on learning ASP. net mvc Framework-MVP, mvc-mvp

Source: Internet
Author: User

Take notes on learning ASP. net mvc Framework-MVP, mvc-mvp
1.2.1 MVP

MVP is a UI architecture that is applicable to event-driven application frameworks. In MVP, M and V correspond to the MVC Model and View respectively, while P (Presenter) replaces Controller.

In MVP mode, only the Presenter can directly interact with the Model, and the View can only indirectly call the Model through the Presenter. The independence of the Model is truly embodied here. It is not only irrelevant to the presentation of visualization elements, but also to the UI processing logic (Presenter.

MVPs not only avoid the deep coupling between views and models, but also further reduce the Presenter's dependency on views. Presenter depends on an abstract View, that is, the IView interface implemented by a specific View. The most direct benefit of this is that it makes the UI processing logic defined in the Presenter easy to test. Since the Presenter's dependency behavior on the View is defined in the IView interface, we only need a Mock View that implements this interface to test the Presenter.

The interaction between the Presenter and the Model is clear. It only shows that the interaction between the one-way call View and the Presenter of the Model is the core of the entire MVP, whether MVP's original intention for separation of concerns can be reflected in specific applications depends largely on whether the interaction between the two is correct. MVP members are divided into PV (Passive View) and SC (SuperVising Controller) modes based on the interaction mode between View and Presenter and the responsibility scope of View.

1. Rules for PV interaction with SC2.View and Presenter (for SC Mode) 3. Example demonstration: Application of SC 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.