MonoRail: Judged By Its Views
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:
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.
Comments
Personally I have never been interested in ASP.Net. The entire thing has always felt wrong to me. But I gave MonoRail a try over the weekend and I'm ready to take on the web world. I'm looking at a few project ideas to try and give it a good shake down cruise.
"Now try to build an Ajax site with this kind of client side nonesense."
Well of course you output control.ClientId in the middle of your ajax script. Which further ties your client script to your server code and on and on.
To be totally honest I have the same impression when I first looked at Ruby on Rails. In fact I wanted to contribute a better view engine to them with support fo webforms-component-like-support.
But then I saw the light :-)
It's great to read passionate people write about the topic of their affection. After all, that is why I keep coming back to read more day after day.
But I'd like to express one concern that I have and that has been very recurring recently. It's so incredibly hard to find developers that at least know how to drag and drop datagrids and hook up events. We had been trying to hire new developers and it was a nightmare. The candidates did not seem to understand how the web works. You know, requests, responses, GET, POST, etc. After a couple of months without finding a reasonable candidate, we just gave up trying to find someone that fit the bill and settled with someone we felt could be taught.
The point I'm trying to make is that ASP.NET lowers the bar to a point where companies can hire "web technicians" (I wouldn't call them developers) and this can be to favorable in the cost/benefit ratio.
As sad as it sounds, many of the developers in the market right now are simply not capable of groking stuff like lightweight containers, MVCs, and lack of visual designers.
The bottom line is that ASP.NET webforms do have their target audience, and that audience's majority is not going to give up the entire suite of webcontrols from MS and 3rd parties too easily.
I hope I don't come across as downplaying our friend developers out there, that's not what I meant. What I mean is that adopting all these interesting technologies definitely sets the bar much higher and it would take time for the developers out there adjust.
You are correct about the state of people that you recruit from everywhere, the quality is amazingly low.
The main problems is that the good developers already has work, and they don't stay in the market for any significant length of time.
That said, I had a project where we used NHibernate, Object Builder, contextful container, generic specialization, decorator specialization and AOP. 90% of the developers there are Morts.
After an explanation on: "This is how you get stuff from the database", "This is how you put data on the form" they had very little issues.
Hey man, cheers for the critical push back although I think you may have posted the wrong id from that link? ;) Maybe my post came across a bit too strong as some sort of critisism of MonoRail (??), far from it since I loved every minute of the project we used it on and plan to continue using it in the future.
Anyway, sure, the leakage of control names and the whole ViewState implementation while costing you in data and correctness does save you heaps in terms of productivity, and particularly this is true when you are either new and learning the whole web medium or if you find the whole WebForms paradigm easier to grok.
For the industry in general, I think we are moving slowly in the right direction to stronger patterns which produce faster and better results, but it's a long tail back there..
I agree with Sergio here, the meat of the ASP.NET environment don't havea thorough understanding of http and html, let alone MVP, IoC etc...
Now, If one can push themselves to learn these new emerging technologies, especially ORM and IoC which I personally think have amazing potential, we would have much higher quality, easier maintable code all the way around. Just in the last month in which I have started playing with MonoRail and some other Castle Components, there seems to be a surge in talk and publicity in this arena which is fantastic. Now if we can just keep the ball rolling!
On a side note, when I first started programming and learned PHP ~8 years ago, there was (and I believe still is) a template engine for PHP called Smarty Template. It reminds me very much of NVelocity and I am pleased to finally see a templating engine that allows me to abandon the ASP.NET headaches.
In the largest project that I have ever coded, which was completed ~4 months ago, I spent countless hours wrestling with the asp.net page lifecycle and all the unspeakable crap that comes along with it. Almost ALL of the bugs associated with the project, were related to viewstate and lifecycle issues. I can only wish now, that I would have stumbled across MonoRail sooner, and as a result am in the process of re-designing the entire frontend of the application to rid myself of the madness.
Sorry to rant, but I believe that I am the happiest person to get rid of ASP.NET....ever
I blogged my response here:
http://andrewpeters.wordpress.com/2007/03/20/aspnet-vs-monorail/
"ctl00___ctl00___ctl00_ctl00_bcr_ctl00___Comments___Comments_ctl06_NameLink" Why do you mock me?! Classic ASP never did this to me.
Did I just missed a joke?
Not sure, but his comment messed with the layout of your site! The right had nav takes up about half my screen. I am adding this comment to get it out of the Recent Comments section...
Opps,
guess he found a DoS attack against the blog :-)
Comment preview