A review of a book "Confident Ruby"
Confident Ruby is a book written by Avdi Grimm, known by a lot of rubists from a podcast ruby rogues, screencasts ruby tapas and his previous books — Exceptional Ruby and Objects on Rails. Unlike useless discussions about OOP in Ruby on Rails, Confident Ruby can be called really useful and interesting work, and it is one of the few books about development I have read.
'Confident Ruby' is a collection of 32 patterns of writing the beautiful, clear and reliable code. One of the main ideas – every method can be divided into the three parts: getting the data, executing the task and handling exceptions. In a 'confident' code these three parts come one by one without turning a program into a mess. If you have always been wondering how to get rid of a lot of if clauses, or how to take arguments properly, or how not to kill the beauty of the code by a begin block with the length of a method, or how to make friends with duck typing – then this book is all you need.
Great advices on refactoring and improving readability and comprehensibility of ruby programs. All the patterns are small, very often one pattern is based on another, or uses previous patterns. No boring theory, any of the patterns can be applied right away and without much thinking (and I have done this several times already), there are no far-fetched abstract ideas.
The book sells in three editions now, I have bought the Gold Label Edition, which includes one more small book about creating null objects and a good half-an-hour screencast, in which the author refactors the code of Discourse.
I absolutely recommend every ruby-programmer to read this, I'm sure that advices from the book will be useful for you as much as they were for me. Avdi writes in the introduction that one of the goals of Confident Ruby is to bring back the joy of writing ruby code to the life of a ruby developer. I won't say that I already have some problems with getting pleasure from ruby programming, but after reading this book you will have a certain boost to an overall programmer's joy ;-)