Skip navigation.

Seventh Beta of The Seventh BetaAll recent postsIs This An Error?

MVC + Traditional ASP.NET = Deadly Combination

A couple of years ago Billy McCafferty wrote about an approach to bring the Model-View-Presenter pattern (MVP) to the ASP.NET. Since then I’ve seen a couple of permutations of the technique, and numerous attempts to actually make it work.

Having gotten frustrated with the Page Controller “pattern” of ASP.NET, I dabbled with Billy’s approach too. It worked pretty good with simple pages, but would get complicated really fast with anything beyond a trivial page.

As of late, I’ve been working quite a lot with REST support in WCF 3.5, when it finally dawned on me:

If you can’t treat everything in your application as an addressable resource in the spirit of REST, MVP won’t work for you.

The bane of MVP/MVC are postbacks and view state. As soon as you need more or less sophisticated interaction with the user, this pattern breaks down. This kind of interaction is prevalent, which is why MVP/MVC fits only a small number of projects.

I still believe that you can practice responsible separation of concerns in ASP.NET, but unit testing becomes almost impossible, among other things. Choose your weapon sensibly.

Comments

Comment permalink 1 Nik Radford |
I disagree.

As, everything in your website is addressable especially if you count a query operator "?" as part of an address. Even post backs are posting to a URL. You may not get to use ASP.NET original view state controls, but plenty of other frameworks get by brilliantly without them.

MVC is about separation of concerns, the fact you can fiddle with your Urls just happens to be a by-product of that.

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):