Model View Presenter Redux

posted @ Tuesday, September 12, 2006 3:53 PM

 

The Model View Presenter (MVP) pattern seems to be all the rage within the last year; it must be the new pink. While I agree this is a great pattern to decouple various logical layers within a system, I think we are missing an important core piece to the puzzle.

In my opinion, humble of course, the Model is purely a representation of my data, and I prefer to depict that in the form of a Data Transfer Object (DTO), this is the ubiquitous PONO (Plain Old .NET Object) - (Edit: Domain Model's are welcome too) . The View is typically defined as an interface that my UI will provide as implementation. The Presenter will then orchestrate the interaction of my Model to my View. But wait, where does my Model come from? This is where a Service layer comes into play. While there are many different terms for this layer, this layer is responsible for extracting our Model from somewhere (i.e., service implementation). Most commonly, our Presenter will perform specific requests from the Service layer in its orchestration process. I would like to refer to this pattern from now on as MVPS (Model View Presenter Service). I’d love to hear feedback on this, in particular if you don’t agree with me – who doesn’t love a hearty debate?