Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Mvp

161 visualizaciones

Publicado el

Mvp

Publicado en: Tecnología
  • Inicia sesión para ver los comentarios

  • Sé el primero en recomendar esto

Mvp

  1. 1. miguel ángel domínguez coloma | eridem MODEL VIEW PRESENTER Miguel Ángel Domínguez Coloma
  2. 2. miguel ángel domínguez coloma | eridem MIGUEL ÁNGEL DOMÍNGUEZ COLOMA ▪ Eridem (eridem.net) ▪ Likes: develop, mentor, entrepreneur. ▪ Professionally: https://linkedin.com/in/eridem ▪ Hobby: http://eridem.net
  3. 3. miguel ángel domínguez coloma | eridem BASED ON stackoverflow https://stackoverflow.com/questions/2056/ what-are-mvp-and-mvc-and-what-is-the- difference
  4. 4. miguel ángel domínguez coloma | eridem …AFTER THE PRESENTATION ▪ Understand MVP ▪ Discuss about differences between MVP and MVC GOAL OF THIS PRESENTATION ▪ Recall that there are variants of MVC and discuss with your team about the CONS and PROS to apply them into your projects
  5. 5. miguel ángel domínguez coloma | eridem WHAT IS MVP? ▪ Variant of MVC ▪ Pattern used to build User Interfaces ▪ Divide UI unit into three entities: ▪ Model(s): store units of information that will be needed for an specific UI component (displayed or not) ▪ Presenter: business logic of a single UI component ▪ View: Represents the visible interface to the user and its internal events Model View Presenter
  6. 6. miguel ángel domínguez coloma | eridem MODEL ▪ Store units of information ▪ External events can update the model. E.g. database updates ▪ The Presenter talks directly with it via interface ▪ The Model can raise events to the Presenter via interface ▪ Access from the view: ▪ Supervising: the view can bind to its data ▪ Passive: the view and the model do not know each other Model View Presenter Model View Presenter Not recommended
  7. 7. miguel ángel domínguez coloma | eridem VIEW ▪ Render data ▪ Contains UI components ▪ Have basic UI validations ▪ Does not have business logic ▪ It communicates directly with the Presenter ▪ Access to the Model: ▪ (previously explained on the Model) Model View Presenter
  8. 8. miguel ángel domínguez coloma | eridem PRESENTER ▪ Contains the business logic of the UI component ▪ Talks directly with the Model and the View through interfaces ▪ Help to communicate between the Model and the View. E.g. mappings or update events Model View Presenter
  9. 9. miguel ángel domínguez coloma | eridem VIEW/MODEL/PRESENTER EXPLAINED WITH SEMANTICS ▪ View: ▪ HideTitle() ▪ SetTitle() / GetTitle() ▪ DisableForm() / EnableForm() ▪ Model ▪ SetId() / GetId() ▪ SetName() / GetName() ▪ SetPrice() / GetPrice() ▪ Presenter: ▪ ValidateInformation(…) ▪ SendInformationToServer(…) ▪ CalculateOperation(…) ▪ DeleteEntry(…) ▪ RefreshUi(…) ▪ SaveUiState(…) ▪ OnModelChanges(…)
  10. 10. miguel ángel domínguez coloma | eridem VIEW/MODEL/PRESENTER EXPLAINED WITH SEMANTICS ▪ View: ▪ HideTitle() ▪ SetTitle() / GetTitle() ▪ DisableForm() / EnableForm() ▪ Model ▪ SetId() / GetId() ▪ SetName() / GetName() ▪ SetPrice() / GetPrice() ▪ Presenter: ▪ ValidateInformation(…) ▪ SendInformationToServer(…) ▪ CalculateOperation(…) ▪ DeleteEntry(…) ▪ RefreshUi(…) ▪ SaveUiState(…) ▪ OnModelChanges(…) Describe elements in the interface that can be used, or general ones Verbs express operations on the UI
  11. 11. miguel ángel domínguez coloma | eridem VIEW/MODEL/PRESENTER EXPLAINED WITH SEMANTICS ▪ View: ▪ HideTitle() ▪ SetTitle() / GetTitle() ▪ DisableForm() / EnableForm() ▪ Model ▪ SetId() / GetId() ▪ SetName() / GetName() ▪ SetPrice() / GetPrice() ▪ Presenter: ▪ ValidateInformation(…) ▪ SendInformationToServer(…) ▪ CalculateOperation(…) ▪ DeleteEntry(…) ▪ RefreshUi(…) ▪ SaveUiState(…) ▪ OnModelChanges(…) Setters and getters for the accessible data Verbs express setter and getters
  12. 12. miguel ángel domínguez coloma | eridem VIEW/MODEL/PRESENTER EXPLAINED WITH SEMANTICS ▪ View: ▪ HideTitle() ▪ SetTitle() / GetTitle() ▪ DisableForm() / EnableForm() ▪ Model ▪ SetId() / GetId() ▪ SetName() / GetName() ▪ SetPrice() / GetPrice() ▪ Presenter: ▪ ValidateInformation(…) ▪ SendInformationToServer(…) ▪ CalculateOperation(…) ▪ DeleteEntry(…) ▪ RefreshUi(…) ▪ SaveUiState(…) ▪ OnModelChanges(…) Business logic that the UI component needs Verbs express business logic in imperative
  13. 13. miguel ángel domínguez coloma | eridem PROS AND CONS ▪ PROS ▪ Every component can be fully testable without dependencies of the others ▪ Changes on the Model do not affect to the View (and vice versa) ▪ Presenter contains only the business logic of this UI component without affect to other components ▪ CONS ▪ Mapping between Model and Views must be done by the Presenter
  14. 14. miguel ángel domínguez coloma | eridem DIFFERENCES Model Model Model View View View Controller Model Model Model View View View Presenter Presenter Presenter MVC MVP
  15. 15. miguel ángel domínguez coloma | eridem DIFFERENCES Model Model Model View View View Controller Model Model Model View View View Presenter Presenter Presenter MVC MVP Views, Models and Controllers have dependencies each one Views and Models are totally decoupled
  16. 16. miguel ángel domínguez coloma | eridem DIFFERENCES Model Model Model View View View Controller Model Model Model View View View Presenter Presenter Presenter MVC MVP Views and Models does not need to be mapped by a third party The Presenter assumes the role of mapping
  17. 17. miguel ángel domínguez coloma | eridem DIFFERENCES Model Model Model View View View Controller Model Model Model View View View Presenter Presenter Presenter MVC MVP Views can reuse existing Controllers due Controllers are behavior based entities Presenters are the business logic of View components
  18. 18. miguel ángel domínguez coloma | eridem DIFFERENCES Model Model Model View View View Controller Model Model Model View View View Presenter Presenter Presenter MVC MVP Models, Views and Presenter are easily testable due they have less dependencies Models, Views and Controllers have a circular dependencies. Harder to test
  19. 19. miguel ángel domínguez coloma | eridem OPEN DISCUSSION Model Model Model View View View Controller Model Model Model View View View Presenter Presenter Presenter MVC MVP
  20. 20. miguel ángel domínguez coloma | eridem QUESTIONS Model View Presenter
  21. 21. miguel ángel domínguez coloma | eridem MODEL VIEW PRESENTER Miguel Ángel Domínguez Coloma Keep learning on eridem.net

×