I’m about to become what I secretly roll my eyes at: a Ruby on Rails evangelist.
Now, I use and love RoR, so you might think that it’s unfair to scoff at those who obviously love it as much as I do. You’d be right, I suppose. In any sort of mass culture, there’s a pile‐on effect (“OMG RoR is the best thing ever!”), after which comes the backlash (“God, Rails users are so annoying, and RoR really isn’t all that”), after which comes the counter‐backlash (“Yeah, Rails users are annoying, but Rails is really quite good nonetheless”).
I find myself in the counter‐backlash camp with just about every “Web 2.0” obsession: Ajax, GTD, Apple, user‐centered design, standards compliance, et cetera. I think it’d be easier to sell these ideas to others if we were a bit less enthusiastic all the time Ã¢â‚¬â€ if it didn’t seem like we’re trying to force the Kool‐Aid down our detractors’ throats.
Everything I’m about to say has been said better by dozens of others. But Ruby on Rails is fantastic for several reasons:
- It’s designed around best practices. In Rails, if you’ve done something wrong in the design of your application — business logic in views, security flaws, redundant database schema — then you’ve done it the hard way. In PHP, the path of least resistance is riddled with all these flaws, and the average PHP coder isn’t even aware of these pitfalls.
- It embodies the DRY principle. Not just in the design of the framework, either. The Rails project I’m working on right now would take three times as long with PHP, just because I’d have to build a bunch of components from scratch. With gems and the plugin system, Rails makes it insanely easy to share code. I’ve got a login system, file upload handling, image manipulation, and a search engine, and I got all that without having to write any code.
- It doesn’t make my head hurt. Java makes my head hurt. PHP makes my head hurt when I’m trying to read someone else’s code. Rails doesn’t make my head hurt because it’s practically self‐documenting — the Rails functions are incredibly well‐named, and Ruby’s syntax is so terse that it makes sense even to those who don’t know the language.
Even if I couldn’t enumerate specific reasons, the bottom line is this: I have more fun writing code in Rails than in PHP. That, above all, is why I’m a loyal Ruby on Rails user.