Andrew Stopford's Weblog

poobah

News

Articles

Family

Old Blogs

MVC and it's .NET bad times

I am a self confessed patterns junkie, I first got the patterns bug a few years back when developing software to component oriented design where you identify each pattern inside of the component. This lead me to research the GoF patterns, the MS patterns and others. Amongst these is the classic GoF patterm the Model View Controller, better known as MVC.

In the .NET world it seems MVC has had it rough, views on it adding complexity has lead to many to oppose it's adoption to the use of the lesser known Model View Presenter (MVP) pattern. The MVP pattern lends it's self well to winform multi threaded applications where MVC is seen as adding huge degree's of complexity. I do really want to focus on ASP.NET however as this can be real mucker for MVC.

Many see ASP.NET as being MVC but the code behind model really confuses things.  If we grant that the code behind and the aspx form the contoller and view then all we need is the model. While ASP.NET does follow MVC to the letter the way it goes about the pattern means that  the controller is not an independent controller, we could not take the controller and make it work with a winform page or anything outside of asp.net, it's tied very closely to the view and we start to loose the the gains of using a pattern.

So adding a true independent controller ensures that it's not tied, while it does add a level of complexity ontop of an existing controller it also means we can reapply the pattern else where and most vital of all we can test each piece as a independent entity to the rest of the pattern.

Is there a better way however, take a look at the work Mike Roberts did in the ccnet web dashboard. Mike largely drops webforms for his own framework that creates a MVC layout but uses a Front-Controller pattern to simplify the controller. Further more take a look at the Castle projects MonoRail system, which looks at creating a true MVC framework for ASP.NET.

Don't give up on MVC just yet.

Posted: Jun 08 2006, 12:00 AM by astopford | with 3 comment(s)
Filed under: ,

Comments

David Findley's Blog said:

Andrew makes some obversations about MVC in the .NET world.I too have been delving into OO principles...
# June 8, 2006 12:28 PM

G. E. Sutton said:

Another alternative that I like is the Presentation-Abstraction-Control pattern, but the truth is that the .Net framework has posed a number of challenges to my implementation. It could be my own skill limitations or simply trying to fit a square peg in a round hole.
# June 15, 2006 10:57 AM

Andrew Stopford's Weblog said:

Rob has been busy, creating two SonicCasts :) MVC and using SubSonic MVC templates . Rails from a ASP

# July 31, 2007 4:43 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)