From the course: JavaScript: Patterns
Model-View-Presenter (MVP) pattern - JavaScript Tutorial
From the course: JavaScript: Patterns
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.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
What are structural patterns?55s
-
(Locked)
Module pattern5m 54s
-
(Locked)
Mixins pattern4m 32s
-
(Locked)
Facade pattern1m 43s
-
(Locked)
Flyweight pattern1m 18s
-
(Locked)
Decorator pattern2m 16s
-
Model-View-Controller (MVC) pattern1m 21s
-
Model-View-Presenter (MVP) pattern1m 17s
-
(Locked)
Model-View-ViewModel (MVVM) pattern1m 25s
-
(Locked)
-
-