- JavaScript:Moving to ES2015
- Ved Antani Simon Timms Narayan Prusty
- 219字
- 2021-07-09 19:07:38
The Model-View-Presenter pattern
Model-View-Presenter is a variation of the original MVC pattern that we discussed previously. Both MVC and MVP target the separation of concerns but they are different on many fundamental aspects. The presenter in MVP has the necessary logic for the view. Any invocation from the view gets delegated to the presenter. The presenter also observes the model and updates the views when the model updates. Many authors take the view that because the presenter binds the model with views, it also performs the role of a traditional controller. There are various implementations of MVP and there are no frameworks that offer classical MVP out of the box. In implementations of MVP, the following are the primary differences that separate MVP from MVC:
- The view has no reference to the model
- The presenter has a reference to the model and is responsible for updating the view when the model changes
MVP is generally implemented in two flavors:
- Passive view: The view is as na?ve as possible and all the business logic is within the presenter. For example, a plain Handlebars template can be seen as a passive view.
- Supervising controller: Views mostly contain declarative logic. A presenter takes over when the simple declarative logic in the view is insufficient.
The following figure depicts MVP architecture:

- Mastering Ext JS(Second Edition)
- VMware View Security Essentials
- ExtGWT Rich Internet Application Cookbook
- 微信公眾平臺(tái)與小程序開(kāi)發(fā):從零搭建整套系統(tǒng)
- AngularJS Web Application Development Blueprints
- 假如C語(yǔ)言是我發(fā)明的:講給孩子聽(tīng)的大師編程課
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第2版)(微課版)
- ANSYS Fluent 二次開(kāi)發(fā)指南
- 編程與類型系統(tǒng)
- 零基礎(chǔ)學(xué)Kotlin之Android項(xiàng)目開(kāi)發(fā)實(shí)戰(zhàn)
- jQuery從入門(mén)到精通(微課精編版)
- Oracle SOA Suite 12c Administrator's Guide
- Learning GraphQL and Relay
- FORTRAN程序設(shè)計(jì)權(quán)威指南
- 編程真好玩:從零開(kāi)始學(xué)網(wǎng)頁(yè)設(shè)計(jì)及3D編程