Model-View-Presenter (MVP) pattern
- Now the next pattern is the Model-View-Presenter pattern, which is loosely based on MVC, and almost the same. Looking at both will help define the major differences in between the two, but they offer similar approaches, but architectured differently. In an MVC, or Model-View-Controller pattern, we have our application organized in models, views, and controllers. Typically the organization will have views, pull data from controllers or models directly, and if there are any other logic or functions needed for the view, the controllers will supply them. So in other words, their views have access to both the models and controllers. Where MVP differs is the view doesn't have to access the model. It has to get it from the presenter and the presenter serves as the logic, and supplier of data. In this pattern, the view passes through the presenter to get the data through functions, and the presenter pulls from the model. It is the major difference. The MVP pattern is seen in several frameworks, such as backbone, but it is quite popular in Android development. So if you plan on developing with Android, understanding this pattern will help you tremendously.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
What are structural patterns?55 秒
-
(已锁定)
Module pattern5 分钟 54 秒
-
(已锁定)
Mixins pattern4 分钟 32 秒
-
(已锁定)
Facade pattern1 分钟 43 秒
-
(已锁定)
Flyweight pattern1 分钟 18 秒
-
(已锁定)
Decorator pattern2 分钟 16 秒
-
Model-View-Controller (MVC) pattern1 分钟 21 秒
-
Model-View-Presenter (MVP) pattern1 分钟 17 秒
-
(已锁定)
Model-View-ViewModel (MVVM) pattern1 分钟 25 秒
-
(已锁定)
-
-