The Joy of Ruby - Avdi Grimm
I was listening to the Ruby Rogues podcast the other day and came across this great quote by Avdi Grimm:
So, the underlying theme here is that joy that you feel when you first write a piece of simple code in Ruby, the first example that I use in the whole book is I was first learning Ruby and I encountered an example like 3.times do puts “Hello world!” end, and that was the best way of saying “Hello world!” three times that I’ve ever seen. It said exactly what it was supposed to do. There was no for (i = 0; i < 3; i++)
There was none of that. It was just very succinct. And it also had this thing where even the number was an object so there was that consistency there where everything was an object. And I loved that.
And I guess a lot of what I’m trying to say is don’t accept the idea that you have to get away from elegance, that you have to lose that kind of expressiveness. Instead, leverage the language. Use the tools of the language to make sure that as the complexity of your programs increases, as the complexity of the situations you have to handle increases, your abstractions and your idioms increase [fractally] so that any given part of that big complex system still looks just as beautiful as that 3.times loop.
Avdi Grimm