Search code examples
mvp

MVP - Does Presenter load Data from Data Layer and translate to Model?


I have seen numerous questions on MVP that mostly revolve around the View and Presenter. My question is more about the interaction of the Presenter with the Data Access Layer.

In my application, my Model very closely reflects the View. i.e. My model only contains the information needed to be displayed on the UI. Hence its really a "ViewModel".

I have the following questions:

  1. Should the Presenter be responsible for making a call into the Data layer?
  2. Should the Presenter map the returned Data to the ViewModel?
  3. Should this mapping take place inside the Presenter? In a separate class?
  4. Is there a pattern I could take advantage of?

Or am I completely off track?


Solution

  • According to my understanding of mvp the presenter does all of the leg work while the view simply arranges the data. Because of this I generally find little need for a ViewModel since the presenter is controlling the data binding directly.

    As far as data access goes, I find it a lot cleaner to have a Helper object that handles the DAL.