I'm looking for feedback on MVP and MVC patterns used as a framework to build a website. I've used both with a certain degrees of success and failure. Furthermore I've worked in places which have miserable implement MVP across the web, desktop and services layers. I've also seen a few terrible MVC implementations. One thing I've noticed is the MVP stuff-up appear terrible for maintenance or adding any new features compared to the MVC debacles.MVP - Model View Presenterhttp://en.wikipedia.org/wiki/Model-view-presenterThe View holds a reference to the Presenter. The Presenter is also reacting to events being triggered from the View, so its aware of the View its associated with.The Presenter updates the View based on the requested actions it performs on the Model, but the View is not Model aware.MVVM pattern was designed to support WPF and Silverlight. It's similar to MVP, in the concept the view doesn't know about the model however its not MVP.
Building websites, which is the better approach MVP or MVC?
mvc;mvp
I guess you're asking in the context of the Microsoft world?It was my understanding that MVP was mainly employed for unit testing the controllers of the application. I think another term for the MVP pattern is Supervising Presenter.The view in this case would be the ASP Page, which would have an instance of the Presenter, and any events in the page (click handler's for example) would delegate their work to the Presenter. The Presenter would have a reference to the View (although, through an IView interface that the Page would implement). The Presenter would then respond to actions from the View, do something, update the model and pass it back to the view or perform actions on the View via the interface. This aids unit testing, because the Presenter (where any presentation logic should be) can have the view mocked out. Typically a Presenter would also have references to other services, which should rely on dependency injection (via constructor injection IMO) to also allow for the Presenter to be tested in isolation (a proper unit test).The main reason I think to use MVP in ASP.NET WebForms is because the Page class is tied to the ASP.NET runtime, whereas because ASP.NET MVC has abstractions on things like the HttpRequest, and the controller and ActionResult classes can be tested in isolation, you don't need to employ MVP - it's unit testable by default.So to answer (I think): I'd use MVP if I was using WebForms, to aid testability. Otherwise I'd use MVC.Also check out the Web Client Software Factory, which offers a framework for a starter point for implementing the MVP pattern.