From the course: JavaScript: Patterns

Model-View-Presenter (MVP) pattern - JavaScript Tutorial

From the course: JavaScript: Patterns

Start my 1-month free trial

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.

Contents