Alex Rivera | Logout

MVC philosophy applied to webforms

Asked 2010-08-20T17:58:47.987
10

I'm pretty new to programming in general (really started only 2 1/2 years ago) and I'm trying to decide what the best way is to approach a web app I'm making at work. A senior developer at work is encouraging me to get into MVC and after a good 24 hours of pouring over blogs, source code and other material on the subject I'm beginning to understand why I'd want to use it.

At the same time though, our company's existing apps are written as WebForms so I don't want to do something as drastic as using the actual ASP.NET MVC framework to make my app(would it really be THAT drastic though?).

What I'd really like to know is whether or not it would be practical or even possible to do WebForms but still follow the MVC philosophy of separation of concerns. Will I really just be adding an unnecessary layer to an already complicated .aspx + codebehind page?

Everyone in the blogosphere seems to think that they MUST use some kind of framework if they want to do MVC. What in WebForms is stopping them from just doing it themselves?

Edit
Report

1 Answer

3

IMHO, I think you should just make the move to MVC.

Here are a few reasons that I am making the transition:

  • I like to be able to control my HTML output. [There are certain web controls that render different tags based on the browser. Additionally, it is nice to have control of the Client ID.]
  • I like to be able to manage the state of my aplications. [As opposed to having WebForms try to manage it for me, passing larger chunks of data around than are strictly necessary.]
  • I prefer to work in a test driven manner and I've found that I can get better test coverage with MVC.
  • I've found that libraries like JQuery work incredibly well with MVC; I've found that making UI elements that were a pain in WebForms have become trivial in MVC.

So, getting back to your question... can you build WebForms apps that utilize many of the lessons of MVC. Sure, and if you are going to build WebForms apps I'd recommend it as a good practice. Can you apply frameworks to make it more like MVC. Sure, but why would you want to when you can just use MVC?

answered 2010-08-20T18:25:59.533

Your Answer