Basics Of MVP

   Model View Presenter Pattern

Model-View-Presenter іѕ a user interface design pattern engineered to facilitate automated unit testing and improve the separation of concerns in presentation logic. One of the keys to MVP is the separation of layers introduced by the creation of a view interface. The presenter doesn't know what implementation of a view, it will be talking to; it just knows that it will be able to call any of the methods defined by those interfaces.  MVP pattern allows us to think at a higher level of abstraction and test implementations of the core interfaces without manually running the application.









 
The three major components of MVP are Model, View, and Presenter 

Model: The model is an interface defining the data to be displayed or otherwise acted upon in the user interface.

View: The view is an interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data.

Presenter: The presenter acts upon the model and the view. It retrieves data from repositories (the model), manages persistence, and formats data for display in the view. The presenter only responds to the user actions and page events (ASP.NET page life cycle) and can only interact with the the UI controls via the View (Interface).

1.1.1.1                Case

MVP pattern will be suitable for the following cases.
  1. Presentation Logic Re-use: Being the presentation logic implemented out of the View, it gives a chance for the developer to re-use it for multiple views.
  2. Automated Unit Testing: Since the view is abstracted, mock views can be created to write automated unit test scripts. This will avoid running the tests without HTTP context
  3. Decoupled User Interface: MVP allows decoupling of the user interface by the view abstraction. This enables to integrate the application to a different platform easily

Comments

Popular posts from this blog

Introduction To Oracle10g

Insert

Except