Aug 12, 2015
Table of contents:
A really good analogy when describing code of high quality is “confident”. When code is confident it is clear, easy to understand and does not exhibit the signs of uncertainty that can easily infect well intentioned code.
Confident Ruby is a book of design patterns that focuses solely on writing methods that are more confident.
This includes how to structure a method, accepting inputs, processing data, dealing with errors and returning output.
The day-to-day life of a programmer involves writing, editing and using the methods of an application. Methods are the fundamental building blocks of application development and so really the quality of the application can be derived from how the methods have been written.
Each individual method when taken in isolation should be easy to understand and use. However, over time, methods have a tendency to get out of control as the requirements of the application evolve.
When a method is not organised it can be difficult to know what’s going on. This can lead lead to bugs and unforeseen errors.
Confident Ruby is a book of design patterns for writing methods that are easy to understand, use, and evolve.
This includes how to organise a method, how to get rid of conditional logic, as well as dealing with special cases and much, much more.
The book is written for Ruby developers and does include a lot of Ruby specific material. However, a lot of the general ideas and principles are applicable to many different programming languages.
Design patterns are really important in software development because they provide battle hardened solutions to commonly recurring problems.
However, a lot of Design Pattern books give abstract or contrived examples that don’t really help you in your day-to-day work.
It’s all well and good learning about these amazing design patterns, but if you don’t use them they are not worth learning.
Confident Ruby introduces the reader to a number of “design patterns” that can be applied to individual methods, rather than all encompassing section of your application.
This makes introducing these patterns into your day-to-day work very easy because it typically only involves a small refactor.
This allows you to experiment and use these patterns without having to totally change how something works.
That was really what I enjoyed the most about this book. Avdi proposes small changes that can be applied iteratively to almost any code base.
These small changes, whilst not revolutionary, will allow you to incrementally move towards a better structured application that is easier to work with.
That’s where a lot of similar books fall down. It’s all well and good if you’re apply these techniques to a greenfield application, but the majority of all applications are not in that situation.
I think learning techniques that can be applied to an existing code base are much more valuable because they can be applied in small stages.
Learning theoretical patterns and practices isn’t much use if you don’t use them.
This book won’t help you with the fundamentals of Ruby, Object Oriented Programming or Software Design Patterns, and it’s definitely not trying to teach you those things.
The book is also heavily written towards a Ruby audience as much of the code uses specific aspects of the programming language that might not translate so easily to your programming language of choice.
I would recommend this book to the following people:
I would also recommend you get the screencast of the higher priced version. In the screencast you pair with Avdi as he applies these patterns to the Discourse codebase.
For a taster of what the book is all about, take a look at the following talk by Advi at Ruby Midwest 2011 https://www.youtube.com/watch?v=T8J0j2xJFgQ