Confident Ruby
MINASWAN
The Ruby community is great. Sure there is the occasional drama, this is a
programmer's community after all, and some are more passionate that others. But
in the end Matz is nice, and so we are nice ; or at least we try hard to be
inclusive and open-minded people, while enjoying the happiness Ruby brings to
coding.
Not content with being one of the nicest rubyists around, Avdi Grimm is also a
podcaster, publishing Ruby Tapas twice a week, and a great
programmer, and I think I could go on, as he is undoubtedly very
prolific. His book Confident Ruby had been gathering virtual dust in the
pile of unread goods for too long, and I thought a short review was in order.
I have been writing code for a few years now, most of it in Ruby because it
suits me, and makes our splendid clients happy. However, I know that with time
and project deadlines closing in, code quality often suffers: no matter how
dedicated and experienced you think you are, mistakes and code smells slowly
creep in.
Avdi's book offers some help in identifying code smells, countless
refactoring opportunities, and more generally to develop good practices so that
your code can remain as confident as it ought to be.
Structure
The book starts by comparing a program's flow to that of a story, and how code
writing shares some similarities with story writing. At the very least,
structure and clarity will help your readers picture what you were trying
to convey.
Generally speaking, a typical function would consist of three parts:
- gathering inputs,
- processing these inputs,
- and delivering output.
Hence, the book is neatly organized in three main sections, each addressing one
of our three core operations. For each chapter, Avdi Grimm provides us with a
collection of patterns that are easily identifiable, and will make our Ruby
code healthier.
So no, you will not find here a hotpot of super advanced meta-programming
recipes, but rather a clear and concise manual of excellent Ruby
best-practices, with deep roots in the object oriented programming paradigm. To
me it looks a lot like a cookbook, one that I will without a doubt come to
consult many times in the future. I almost regret not having a paperback
version, for the pleasure of cornering the pages.
Just go and read it already
In the end I really enjoyed reading Avdi's advice, so if you are serious about
programming in Ruby, I can only recommend this excellent book. It will help you
write better code that makes you happier, which is what Ruby is all about.
And as is customary, happy hacking!