Ruby Reloaded
(Mon Oct 18, 2004) [/Books] #
Have you tried Ruby yet? If not, you owe it to yourself to experience the joy of this beautiful language. And with the second edition of Programming Ruby hot off the presses, there's never been a better time to start learning Ruby. I'm usually not enticed by second editions, but this edition is much more than just a dusting of the cover. Ruby has grown significantly since the first edition of the book, and in this second edition you get over 200 pages of new content and wisdom. So this feels like an entirely new (and improved!) book to me.
I've not been keeping up with all the new libraries that ship with Ruby, which is why I especially like that this edition of the book covers all 98 standard libraries that come stock with Ruby 1.8. Actually, what I really like is the way those libraries are covered. When I'm searching for a library to make my work easier, I don't want an API reference. What I want is a short example of what the library can do. This edition of the book does just that: it presents an example use of each standard library, one library per page.
If you've been wondering if you can live without static typing, then I recommend you start by reading Duck Typing, a fantastic new chapter in this edition. The first code I wrote for money was in Ada, and that was after four full years writing Ada code for professors, so trust that I've been sufficiently brainwashed into thinking that static typing is required to build reliable applications. The more Ruby code I write, the more I'm convinced that this just ain't true. Duck typing: it's not just for quacks.
I taught myself Ruby by writing learning tests while reading the first edition of the book. Every time the book presented a snippet of Ruby code and the result it produced, I turned that knowledge into a self-checking test. Once I'd reached the end of the book, I had a fairly comprehensive suite of tests that I continue to use as a knowledge base of example Ruby code. That is, I learned how Ruby works by writing tests that validated my understanding of the language and its libraries. It's a technique that continues to serve me well with Ruby, and with other languages and libraries. If this sounds appealing to you, I recommend you read the Unit Testing chapter second. It does a great job of explaining how to use the testing framework that comes with Ruby.
So if your world revolves around Java, as mine did, then you seriously need this outstanding book to learn all the wonderful things you're missing (blocks anyone?). In addition to learning a fun new language, learning Ruby has made me a better programmer in general. And even if your project has no intentions of using Ruby, you'll be honing new skills while discovering ways to improve on old skills. There's just one catch: you'll be spoiled from then on. Indeed, after reading just a few pages of Programming Ruby, programming in any language other than Ruby will feel like you're pushing rope.
