I think HAML is great

Mini post, mostly to pick up on some tweets about HAML that I wanted to respond to. But not in 140 characters.

HAML is fantastic. If you’re writing Rails apps, you should be using it. We’re working on making something similar for PHP.

So, today, I was surprised to see clever people knocking it. I asked what was going on and Markng said:

@harrym my largest objection is that it’s an abstraction over something that doesn’t need abstracting. (link)

@harrym maintainability involves people after you picking up code. People who don’t think learning another html syntax was necessary. (link)

@harrym good html is fine to read. Bad HTML not so much so. Maybe some are using HAML as a discipline mechanism. (link)

@harrym furthermore, the biggest reason for abstraction is when there is more than one output or source. Not the case with HAML. (link)

First of all: it’s not really an abstraction at all. I know that it calls itself one, but it isn’t, really. It’s just an alternative syntax. So let’s rename it to Html Alternative Markup Language and forget about that one!

You’re right that people’s unfamiliarity with HAML is a barrier to maintainability, but that’s true of any new technology. That it’s a barrier isn’t really the point: the more important question is whether it’s a barrier that’s worth breaking through. I say that it is. Once you have learned it (which is hardly difficult) it becomes much easier and quicker to write clean, readable, valid markup. Less stuff to write, less stuff to read, fewer lines than the HTML equivalent. Win.

As for using HAML as a discipline mechanism. That’s partially true. Then again, it’s true of compilers, too, and non-superuser accounts on *nix boxes, and typed languages, and object orientation. All of those are, among other things, discipline mechanisms. What’s bad about that?

If you can enforce discipline while also being easier, quicker and more elegant, haven’t you just made some better technology?