开发者

three tier and MVP pattern in shopping website

开发者 https://www.devze.com 2023-04-10 23:21 出处:网络
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.

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 sh开发者_运维问答ould 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.


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.


The Data Table is your model. Or the way I prefer to think about it is the entire business layer is the model, and the UI contains the View and Presenter.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号