David Heinemeier Hansson was so fed up with PHP and Java that he almost gave up on programming altogether—then he found Ruby and everything changed.
Question: What inspired you to create Rails?
David Heinemeier Hansson: Rails really started as an application. It never started as Rails. It just started as me wanting to build Basecamp in this new program language—new to me program language—called Ruby. And as I was starting to build a Basecamp, our project management tool at 37Signals, I found a need to just build a bunch of tools for it. I had to have something to talk to the database, something to generate some HTML. All these things I weren’t finding good existing solutions for in Ruby, so I basically just had to do it myself.
And what I found was someway, halfway into the creation of Basecamp that I had this big toolkit now. I’d been building all these little things that I needed as I needed them, and now I discovered that I had a whole toolkit. And I also discovered that I like programming now so much better than I ever had in the past. So what was making me happy about this? Well, first of all, obviously, the Ruby language, but also all these tools I’d built for myself. They just felt just right in a way that no other programming language or environment had before.
So I started thinking: hey, if I’m having so much fun building with these tools, building with Ruby and then what became Rails, it can be selfish not to share that. All the things that we build at 37Signals are built on top of open source tools. We use Linux, MySQL, Ruby itself. All of these infrastructure components are open source; they’re free, and you can use them, you can change them, you can do whatever you want. So it kind of feels like once you’re in that world, you’d be an ass if you just developed something you liked a lot, and then you just kept it to yourself. Like, “This is my toy, and nobody else can play.” So that seemed like a bad idea.
So about halfway through the development of Basecamp I just realized I’m going to release this. I’m going to put it out into the world, but, before I do so, I want it to be good. I’d used a bunch of software that I found really, really frustrating to get into because either the documentation was bad, or the examples were lacking, or it just didn’t feel polished. So I wanted Rails to feel really polished. I wanted it to have great documentation, be easy to get started with and get into, so I actually waited about a year from when I decided I was going to release this, until I actually did. And it wasn’t until that year later where it felt good enough for somebody else to use.
Question: If you were to start again, would you choose Ruby as the basis for Rails?
David Heinemeier Hansson: If I had to do Rails today, I would absolutely choose Ruby. Since discovering Ruby, I really haven't been all that interested in other program languages. It's kind of funny; when I used to develop in PHP or the stuff I did in Java, I was always looking for something else. I was always looking for another programming language, another... just something else, in part just to distract me from being bored in the languages I was in.
But with Ruby it was kind of different. Ruby right from the beginning just fit like a glove. It was this magic language that sort of like your thought's been waiting for. Like this was the language that was going to express what I have to say in such an eloquent way that I'm frequently just astonished. I'll write a piece of code and look at it and say, “Geez, that's beautiful!” And I would not have that reaction before, just because other program languages just to me don't have that emotional appeal. Ruby has just a deep emotional appeal of how beautiful you can write something. It feels much closer to my thought process. It feels like I'm expressing exactly what I want to say in code without translating it. Usually you call it code because it's sort of hard to read and hard to understand, but Ruby really shouldn't be called code because it's much closer to human thought than code is.
Question: What exactly is the relationship between Ruby and Rails?
David Heinemeier Hansson: Ruby is sort of the basic language. You can say anything in Ruby. You can talk about anything in Ruby. There's no limits to that. Rails is much more like a genre, so rails is like "thrillers." Like, if you want to make a thriller, you use Rails for that. If you're using something else, if you want to write a love story, then you probably use another framework or something else entirely. Ruby is great for both of those things, but Rails is really the tool that sits on top of Ruby that just makes Ruby great for web development... talking to a database, outputting, HTML, putting all these things together and making great web applications.
Recorded July 22, 2010
Interviewed by Peter Hopkins