MonoRail: Judged By Its Views

time to read 3 min | 463 words

Jeremy Boyd posted about his experiance with MonoRail. He had used it in a project (along with the WebForms views), but he had this comment about it:

When I was doing my build I took a look at Brail and NVelocity as view engines and to be honest I found them an amazing step backwards from ASP.NET. Maybe I’m just lazy, but I do find that you get a lot of benefit (largely from the automatic eventing and management of control state) inside the ASP.NET framework and it feels like going back to classic ASP in some cases (ignoring some of the control/binding support you get).

This automatic eventing and control state management comes as a very high cost. I copied the link to Jeremy's blog from his site, here is the ID for the link "ctl00___ctl00___ctl00_ctl00_bcr_ctl00___Comments___Comments_ctl06_NameLink". Now try to build an Ajax site with this kind of client side nonesense.

This high cost is not only in terms of a more complex client side experience, but it terms of more complex model to work with. Page Life Cycle is a burden, you need to do so much to get so little. Remember, at the most basic level, we are talking about generating text.

MonoRail's views are templates, they are designed, on purpose, to be as near the generated content as possible. This reduce the amount of work that you have to do. You get to work with a single model all the way through. Something like Ajax Generators is either not possible or completely not trivial to make in WebForms. And the number of ways your can extend MonoRail to fit your needs is amazing.

Web Development is not hard.  It is a simple model, and shouldn't be complicated. What is complicated is meeting the business needs, producing pleasant looking and usable UI and ending up with a maintainable application.

Now, to the crux of Jeremy's problem. The templates are HTML mixed with minimal control flow, and they do look similar to the way classic ASP worked. The main difference is that the templates are not doing anything beyond presentation logic, and a little of that anyway. MonoRail has the concept of ViewComponents, which are similar to the controls in WebForms. Those will usually take care of any complex presentation logic needed for the application.

The end result is that you have a maintianable application, with easy to follow, easy to understand code paths and usages.