posted on Thursday, July 26, 2007 1:28 AM by timbarcz

MonoRail, a refreshing view into MVC

The Model View Controller pattern (MVC) seems to be the pattern du jour in many development shops.  That is until of course, some literate nerd reminds everyone, that there is "No Silver Bullet."  The recent rush to Ruby on Rails, which implement this pattern out of the box, has only served to add to the number of people singing the praise of MVC.  Microsoft marketing fed programmers seemed to be quick to retort that the WebForm in Asp.NET is in fact an MVC implementation.  I can't speak for others, but "the codebehind is the controller" always felt a bit like kissing your sister.

The other day I started playing with MonoRail, Castle's MVC implementation for the .NET framework.

"MonoRail differs from the standard WebForms way of development as it enforces separation of concerns; controllers just handle application flow, models represent the data, and the view is just concerned about presentation logic. Consequently, you write less code and end up with a more maintainable application."

My first reaction after overcoming the newness and understanding the project/solution layout was that this felt like how it should be.  I was programming a class and that class held nothing more than data about the object.  My controller for that "model" was shuffling things around and making the decision about what to do and when.

There are obviously some things you give up when going to MonoRail but I hope to assuage your fears and mine by digging in a little further.  Here are the items I have on my notepad to learn:

  • Are base class library tools (TextBox, CheckBoxList, ect) as well as third party tools (ie. Component Art or Telerik) no longer available?  If they're no longer available are the counterpart offerings as good as what is offered using WebForms?
  • Ajax?  Seemingly ASP.NET Ajax is out if you go with MonoRail, so what to use instead?  Has MonoRail adopted one of the javascript libraries as it's main provider for javascripting/ajax?  If so how does it compare in ease of use when compared to ASP.NET Ajax?
  • Af first glance, there also no longer seems to be ways to use server controls or user controls?  Is this statement accurrate?  If so what is the proposed method of getting the same functionality.

The MonoRail/Castle team has done an incredible job in my mind at making this a viable option instead of WebForms.   I still have a lot of reservations about the end-to-end usage, but I've let down my guard immensely after getting my feet wet.  Judging from the user base out there by viewing blog posts and/or forums about MonoRail there's enough of a following that I'm fairly certain the issues above are solved.  If they are in fact solved, then I have great confidence that they'll be just as easy and "right" to use as MonoRail, which will make MonoRail hard to ignore for future projects.

Comments