I’ve taught a fair number of Ruby classes over the years, but one particular class stands out in my mind. The class was over, and as I was going out the door one of my students, an experienced Java programmer, stopped me and voiced a complaint that I have
heard many times since. He said that the hardest part of learning Ruby wasn’t the syntax or the dynamic typing. Oh, he could write perfectly correct Ruby, sans semicolons and variable declarations. The problem was that something was missing. He constantly found himself falling back into his same old Java habits. Somehow his Ruby code always ended up looking much like what he would have written in Java. My answer to him was not to worry, you haven’t missed anything—you just aren’t done learning Ruby.
What does it mean to learn a new programming language?
Clearly, like my frustrated student, you need to understand the basic rules of the grammar. To learn Ruby you need to be aware that a new line usually starts a new statement, that a class definition starts with the word class, and that variable names start with a lowercase letter—unless they start with an @. But you can’t really stop there. Again, like my erstwhile student, you will also need to know what all of that code does. You’ll need to
know that those statements are really expressions (since they all return a value) and that all of those classes starting with the class keyword can change over time. And you’ll need to know why those @variables are different from the plain vanilla variables.
But the punch line is that even after you master all of this, you are still not quite there. It turns out that computer languages share something fundamental with our everyday order-a-pizza human tongues: Both kinds of languages are embedded in a
culture, a way of thinking about the world, an approach to solving problems. A formal understanding of the mechanics of Ruby isn’t the same as really looking at the programming world through Ruby-colored glasses. You need to absorb the cultural part
of Ruby, to see how real Rubyists use the language to solve problems.
This is a book about making that final leap, about absorbing the Ruby programming culture, about becoming truly fluent in Ruby. The good news is that for most people the final step is the best part of learning Ruby—a series of “Ah ha!” moments— as it suddenly becomes clear why those funny symbol things exist, why classes are never final, and how this wonderful language works so hard to just stay out of your way.