Reputation: 1341
Since the MVP pattern allows more testability and some reuse in webforms apps, i thought it would be a good first step to moving to MVC for legacy(webforms with code in codebehind, no pattern). As I refresh myself with MVP internals, it doesn't seem so. Anyone have experience using this approach. Would it be better to just add MVC to your project and start porting pages/views?
Note: I have webform apps that inject controls dynamically, keepin the amount of pages down to 4 or less (single page webforms app).
Upvotes: 2
Views: 607
Reputation: 918
Proper separation of concerns should make the transition easier if needed.
MVC framework is suitable only for web applications, while MVP can be more universal and can work for Web forms and Windows forms - views implement interfaces for presenters to use and views themselves handle implementation details pertaining to navigation.
You say that you insert controls dynamically. If you do this to have UI consist of reusable and self-sufficient components then this principle does not work well with MVC - controllers there want to have complete authority over a page and implementing that on MVC would lead to a mess of sub-actions, partial views and view model sharing.
In my opinion, MVP + Web Forms is best suited for Enterprise Web Applications where pages are highly modular with interconnected components,MVC - for general Web Sites where a page corresponds to a single action with domain object, usually CRUD or is optimized more for reading.
Upvotes: 2
Reputation: 50728
It would be better to directly port to MVC, IMHO, for several reasons:
We use MVP on a project at work. To migrate my project it would be easier to do, but I would just rather shoot for the final product rather than use a migration step... it will be less time overall and a lower cost that way, IMHO.
HTH.
Upvotes: 1