
Haml seems to be the (not so) new hawtness in the rails world. I’ve had some developers who work for me love it and others who hate it. I’m part of the latter group, for two main reasons.
First and foremost, Haml adds a learning curve to your development team. Granted, it’s not a huge learning curve, but it’s a learning curve nonetheless. The problem in this regard is that if you don’t spend a lot of time writing views, going back to edit old Haml code is very difficult because people tend not to “know it by heart” like they do HTML. So the learning curve never really goes away unless you’re constantly writing Haml code. The simple fact is that most developers have been writing HTML code for years and are intimately familiar with it, adding a layer above this is going to slow them down. Also, when new developers enter the organization, if they don’t already know Haml, they will have to spend time learning it instead of hitting the ground running.
Second, anytime you have to render Haml into RHTML, you’re taking a performance hit. Here is an excerpt from the Haml release notes. “My benchmarking seems to show that Haml is now only 5% to 12% slower than ERB when run through ActionView.”
Yes, Haml makes pretty views, but is it really worth it to sacrifice work performance and site performance for pretty views that the end user will never even know about? Me thinks not.
To your first objection: I think any developer can learn HAML in a matter of hours, so this is not really a valid argument.
As to your second objection, HAML caches template output, which often makes it way faster than ERB.
From the current release notes:
“[...] According to our benchmarks, Haml is now slightly faster than ERB, even when rendering via ActionView.”
I disagree.
Not with your assessment of haml, but with the idea that haml makes ‘pretty’ views. No, it absolutely does not. It’s ugly and slow for your brain to parse, especially after the developer community has been trained onto XML for 20 years.