Search code examples
c#asp.netdesign-patternsmvp

three tier and MVP pattern in shopping website


i'm creating a shopping website using c# and asp.net and i want to use MVP pattern inside of three tier architecture, specifically in the presentation layer. the reason i'm doing this is because i've been read and heard that MVP is a UI pattern however i came across a design problem! if MVP is a UI pattern and it should be used inside of presentaion layer and so it's not a representation of a database table then what exactly would make up my model??

i suspect that the data from the business layer is making up my model but when i think about it the only thing that is coming to my presentation layer from my business layer is the requested data table. so what would make up the model?

for an example consider the amazon.com as the shopping site that i'm trying to create.


Solution

  • I will probably be in the minority with this, but whenever I talk about the usage of any of the MV* architectural patterns, I often do not apply it at a system wide level, but on a individual component level.

    For example, Java Swing UI elements are built using MVC principles. That is to say that MVC is being applied on a component level in the presentation layer.

    For your case (using MVP only in well-defined presentation layer), your MVP model could be a shell that interfaces with your business logic layer. Or it could be domain POCOs, that get instantiated by repositories.