My opinion about HAML/SASS

This is my response to Kyle Simpson’s post about HAML.

Let’s start with a disclaimer of my own: I haven’t used HAML (or SASS) in a real environment, so I don’t know how useful it can be.

Now, with that out of the way, here’s my opinion, based on Kyle’s post:
HTML (and CSS) are two languages that are easy enough to learn. Of course, there are certain intricacies related to how browsers handle HTML and CSS, but that doesn’t change the difficulty of writing in those languages. A link will always be marked up with an a tag, and you’ll always use the background property to set background styles on an element. Once you get the basic syntax, there’s not much you can do wrong (luckily Geocities doesn’t exist anymore to disprove my point ;)).

I agree with Kyle that templates should contain as little logic as possible. This allows for them to be easily changed to be used with a different server side language and makes them easy to maintain for people that have little to no knowledge of the server side language that’s being used. And of course, there’s the whole separation thing; client side developers are always very adamant about separating HTML, CSS and Javascript, so why should you mix HTML and server side languages (above a certain level)? So, to keep things simple, a templating language should, in my opinion, probably only offer simple variable replacement.

I also agree with Kyle that languages based on indentation don’t make sense. I also like the clarity of having something wrapped in brackets, like it is in Javascript. On top of that, I don’t see the advantage of having to type HTML-like syntax, and leave out the closing tags, or even the brackets around the tags. Yes, it requires more key presses, and I’ve been taught that programmers are extremely lazy (hence the DRY principle), but if that means adding some kind of processing (which requires server power), then I think you’re going overboard.

And to round off my response, here’s a little analogy: I prefer reading books by English authors in their native language instead of a Dutch translation, because I can understand all the subtle nuances and jokes the authors make as they intended them when they wrote them down. However, if my English wasn’t that good, I’d probably prefer the Dutch translation.
It’s the same with HTML versus HAML. To really understand what’s going on, it’s easier to look at the HTML code that’s being put out, as long as you have a good understanding of HTML. However, if you’re not really that good at HTML, but understand HAML very well, you’ll probably prefer reading the HAML code. But that will always mean that you won’t always get the subtle nuances of HTML (granted, there aren’t that many, but if you look at CSS vs SASS, then it starts to make more sense).