Learn the ASP. NET MVC framework Secret Note-MVP

Source: Internet
Author: User

1.2.1 MVP

Mvpis aUIschema mode for event-driven application frameworks. MVPin theMand theVrespectively correspondingMVCof theModeland theView, whileP(Presenter) instead ofController.

In MVP mode, the ability to interact directly with the model is limited to Presenter,View Model can only be called indirectly through Presenter. The Model 's independence is truly reflected here, not only with the rendering of the visual element, but with the UI processing logic (Presenter ) is irrelevant.

MvpIt's not just about avoidingViewand theModelthe depth of the coupling, further reducing thePresentertheViewthe dependency. Presenteris dependent on an abstractView, that is, specificViewthe implemented interfaceIView, the most immediate benefit of this is to make the definitionPresenterin theUIprocessing logic becomes easy to test. BecausePresentertheViewthe dependency behavior is defined in the interfaceIView, we only need toMockone that implements the interface.Viewwill be able toPresenterto test.

Presenterand theModelthe interaction between them was clear, and he merely embodiedPresentertheModelone-way invocationViewand thePresenterThe way to interact with each other is the entireMVPthe core,MVPWhether the original intention of the separation of concerns can be embodied in the specific application depends to a large extent on the correctness of the interaction between the two. FollowViewand thePresenterthe way you interact with each other, andViewIts own terms of reference, wouldMVPdivided intoPV(Passive View) andSC(supervising Controller) two modes.

1.PVwith theSC2.Viewand thePresenterthe rules for interaction (forSCmode)3. Example Demo:SCapplication of the pattern


Learn the ASP. NET MVC framework Secret Note-MVP

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.