If you’re an experienced Ruby programmer, Effective Ruby will help you harness Ruby’s full power to write more robust, efficient, maintainable, and well-performing code. Drawing on nearly a decade of Ruby experience, Peter J. Jones brings together 48 Ruby best practices, expert tips, and shortcuts—all supported by realistic code examples.
Ìý
Jones offers practical advice for each major area of Ruby development, from modules to memory to metaprogramming. Throughout, he uncovers little-known idioms, quirks, pitfalls, and intricacies that powerfully impact code behavior and performance.
Each item contains specific, actionable, clearly organized guidelines; careful advice; detailed technical arguments; and illuminating code examples. When multiple options exist, Jones shows you how to choose the one that will work best in your situation.
Ìý
Effective Ruby will help you systematically improve your code—not by blindly following rules, but by thoroughly understanding Ruby programming techniques.
Ìý
Key features of this concise guide include
How to avoid pitfalls associated with Ruby’s sometimes surprising idiosyncrasies What you should know about inheritance hierarchies to successfully use Rails (and other large frameworks) How to use misunderstood methods to do amazingly useful things with collections Better ways to use exceptions to improve code reliability Powerful metaprogramming approaches (and techniques to avoid) Practical, efficient testing solutions, including MiniTest Unit and Spec Testing How to reliably manage RubyGem dependencies How to make the most of Ruby’s memory management and profiling tools How to improve code efficiency by understanding the Ruby interpreter’s internals
Effective Ruby takes a comprehensive look at the details professional programmers should know about their chosen language. It covers the subjects we should already be familiar with, like testing and best practices, but also dives into the less explored corners of Ruby, like profiling and garbage collection. This is a must have for any Ruby professional.
This is a very strange book because, while it does go tackle some more advanced topics, it does so begrudgingly.
Quite revealing is the author's early stance on optional coding style, as he thinks that "it's a bad habit to omit parenthesis and one the community needs to wean itself from." There are many things that you need to "be aware of" or you need to "be alert for". Of course, no programming language is perfect, but most language designers understand the trade-offs they are making and advanced books like this one should be able to spend the time and explain why those design choices were made, what are the advantages and how it might impact you, as a developer. This is certainly the path taken by books like , or (weirdly enough, the last two books have the same publisher, Addison-Wesley).
There are definitely some useful bits of information in this book, especially for junior or intermediate Ruby developers, but I'm having a hard time recommending this book over , as it's more recent, covers more topics in much more detail, or over , which has a similar "cookbook" format, while both have examples written in idiomatic Ruby. So I guess two stars should suffice.
Peter J. Jones, the creator of Vagrant, brings us "Effective Ruby : 48 Specific Ways To Write Better Ruby". A book geared towards ruby programmers that are already familiar with the structure and syntax, but are looking to get more out of the language. The books covers a wide range of topics, with surprising amount of depth. The chapters are divided into small 'items' that can be consumed individually and stand (mostly) on their own. Each offers practical tidbits that can be applied to your own code immediately. I read the book cover-to-cover, but I it would also be suited to jumping around from item to item.
I found the chapter on Classes, Objects and Modules to be very useful in understanding how Ruby treats inheritance and method dispatching and the implications of which the reader should be aware of. Also of note, the chapter on meta-programming sheds some light on very useful techniques to avoid shooting yourself in the foot, a pretty common occurrence when meta-programming in Ruby.
I have been programming Ruby for years and I enjoyed reading the book a great deal. I learned some new tricks and re-acquainted myself with some forgotten ones as well.