I *heart* Rails

(With any luck, this is just part one of an ongoing series)

So, I like Ruby a lot, intellectually speaking. I love the duck typing, the mixins, I love closures and blocks, I dig the direct OpenSSL support, etc. Having never been paid a dime to actually produce anything of value in it, though, I wasn't able to speak to its productivity as a professional language before.

Now, however, that has changed (sort of). I've been working on an application using the Java/Spring/Hibernate/JSTL stack (Mr. Geary, Mr. Lewis Shipp, please don't kill me for that last bit). The application is not overly complicated, though the domain model is a tad hairy. I've been working on the application for more than 5 months now. I recently decided to start re-implementing it in Rails. My experience has been surprising.

First of all, I've been able to re-implement 80% of the functionality in just under four nights of work. Some of that most assuredly has to do with the fact that I understand the domain pretty thoroughly by this point. But a lot of it has to do with the sheer productivity of the framework. Given that I have complete control over the data schema, I was able to make a total of 7 edits to the schema to get it to work perfectly with Rails' defaults for mapping. That alone has saved me thousands of keystrokes.

Secondly, implementating changes and running tests takes no time whatsoever. The configure, compile, deploy, reset cycle for running tests is time consuming on my original stack, and non-existent with Rails. This particular facet caught me off guard; I wasn't expecting that to make much of a difference to the overall experience.

There's a lot of other things I like about the framework, like the view technologies (partials and helpers, rhtml, etc.), the well-constructed controller hierarchy, and the new routing features, all of which I'll probably tackle in further posts. But mostly, I wanted to say this:

Rails is actually faster.

At runtime, the Rails implementation is at least as fast as the original stack in almost every case, and for a not-insignificant portion of actions, actually performs better. I haven't run benchmarks yet, but I will as this effort progresses, but I was shocked (shocked, I say) to discover this.

I don't know if I can switch the project over to Rails; I haven't even mentioned this experiment to my customer yet, so I don't know if this will end up being my first commercial Rails project or just an experiment. But regardless, I can now say that I hope it won't be my LAST Rails project.