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