Ruby Books

Ruby booksThis page features a collection of some of the best Ruby books for all learning levels.

I will guide through the process of selecting the best Ruby book for you, based on my expertise with the language (programming in it since 2004), my extensive experience with mentoring young programmers, and having reviewed dozens of Ruby books over the years.

Ruby books or Ruby on Rails books?

This page is dedicated to the best Ruby books available on the market as of today; not the best Rails books. If you are new to the Ruby ecosystem, it’s important to understand the difference.

Ruby is a beautiful programming language that can be used for all sort of purposes. Ruby on Rails (Rails, for short) is a highly productive and popular web framework written in Ruby.

You’ll write lots of Ruby code in the process of writing web applications in Rails, so if you are looking into Ruby because of Rails, I highly recommended that you get both a Ruby and a Rails book.

If Rails is of interest, check out my Ruby on Rails books page as well.

What’s your degree of Ruby expertise?

In order to recommend the best Ruby book for you, I’ll need to know your current programming and Ruby expertise. Click on the link below that most applies to you.

Ruby books for people who never programmed before

Ruby Books: Learn to ProgramIf you never programmed before, you need a Ruby book that doesn’t just teach you the language, but also teaches you how to program. For example, you might need to learn not just the Ruby syntax to work with arrays, but also be explained what arrays are in the first place.

Thankfully you have a couple of very good gentle introductions:

You can’t really go wrong with either Ruby book here. If you like a fun, whimsical style aimed at kids, pick Ruby Wizardry. Otherwise, go with Learn to Program (2nd Edition).

After you’ll be done with either of these two books, you can tackle one from the next section below.

Ruby books for programmers

If you already know how to program, I can recommend one of following two books:

Beginning Ruby: From Novice to Professional (3rd Edition) by Peter Cooper

This is a great introduction to Ruby for beginner programmers. It lays down solid foundations for the Ruby Books: Beginning Rubylanguage, while also nicely introducing the whole Ruby ecosystem. The author, Peter Cooper, is a well-known figure in the Ruby community, and in this Ruby book, he clearly demonstrates his ability to teach and communicate with newcomers. This third edition was released relatively recently (it covers Ruby 2.3) and is comprehensive enough to act as a good, current reference book as well.

Programming Ruby 1.9 & 2.0: The Pragmatic Programmers’ Guide (4th Edition) by Dave Thomas

Ruby Books: Programming RubyThis is the fourth edition of the so-called “pickaxe”, the book most Rubyists have used to learn Ruby since 2000. This book acts as a tutorial and reference, and it’s aimed at professional developers, as it’s full of advanced concepts and theoretical explanations that go deeper into the ‘why’ and ‘how’ of Ruby and Agile programming. Not everyone’s cup of tea, but definitely well worth it if you are already quite familiar with object-oriented programming.

If you know some programming, but don’t have at least a couple of years of professional experience under your belt, I’d recommend Beginning Ruby instead. It has also the advantage of being newer and therefore slightly more current. Otherwise, go with Programming Ruby.

Ruby books to take your Ruby skills to the next level

The following list of Ruby books is aimed at programmers who already know Ruby. Whether you know it at a novice level or intermediate level, all will teach you something you don’t already know about Ruby and programming in general.

These intermediate to advanced Ruby books are all excellent follow-ups to the books listed in the previous section.

The Well-Grounded Rubyist (2nd Edition) by David A. Black

Ruby Books: Well Grounded RubyistApproachable guide to the language that doesn’t shy away from more advanced topics or in-depth explanations. As the title implies, this book will make you a well-grounded Rubyist who produces idiomatic code and understands the why behind the how. More experienced developers (in other languages) might even consider starting with this book instead of the ones in the previous section.

 

The Ruby Way: Solutions and Techniques in Ruby Programming (3rd Edition) by Hal Fulton and André Arko

Ruby Books: The Ruby WayIt looks like a cookbook and within its pages, you’ll find plenty of HOWTOs for several common tasks. It is, therefore, a valuable book if treated as a cookbook, but that’s not its main purpose. The Ruby Way is about learning how to deal with a variety of programming tasks in an idiomatic manner. This book is about learning to code the Ruby Way.

The first edition of this Ruby book is where David Heinemeier Hansson, creator of Rails, learned most of what he knows about meta-programming and Ruby. I personally consider The Ruby Way to be a definite must-have, it’s chock-full of practical examples and advanced lessons.

Practical Object-Oriented Design in Ruby: An Agile Primer by Sandi Metz

Ruby Books: Practical Object-Oriented Design in RubyIf you want to fully grasp object-oriented programming in Ruby, this book will certainly help. Though it came out in 2012, it doesn’t really matter. It remains a great primer on the topic of OOP in Ruby. (You can now pre-order the 2nd edition, which is coming out in August 2018.)

Ruby Cookbook (2nd Edition) by Lucas Carlson and Leonard Richardson

Ruby Books: Ruby CookbookUpdated to Ruby 2, this second edition of the Ruby Cookbook is an invaluable tome that should have a sweet spot on your desktop. It provides more than 800 pages of idiomatic Ruby code recipes for common, highly interesting tasks. If you learn by doing, this book alone will be able to give you a great deal of insight into Ruby. Each recipe is thoroughly explained and will always be at hand, ready to help you out if you are stuck with a given problem. It’s not the type of book that you read cover to cover (unless you want to), but it’s a must-have for Ruby programmers of all levels – and one that you’ll use a lot.

Effective Ruby: 48 Specific Ways to Write Better Ruby by Peter J. Jones

Ruby Books: Effective RubyI’m a big fan of the Effective series by Addison-Wesley and they certainly did not disappoint with this one. Although some of the 48 “items” presented will appear a bit too basic to some, the book is still full of tips and tricks that will make you a better Ruby programmer.

Refactoring: Ruby Edition by Jay Fields, Shane Harvie, and Martin Fowler

Ruby Books: Refactoring RubyPublished in 2009, this is the only book in the list that genuinely uses an outdated version of Ruby. It is, however, a conceptual book so it doesn’t really matter, and what you’ll learn from it can be applied to any Ruby version (and to a good degree any object-oriented language). Testing and refactoring are key practices within the Ruby community and this book does an excellent job of explaining both the how and why. This book will make you a better programmer, not just a better Ruby programmer.

Ruby Performance Optimization: Why Ruby is Slow, and How to Fix It by Alexander Dymo

Ruby Books: Ruby Performance OptimizationThe title says it all. Ruby is a great language, but it’s not the fastest. It’s optimized for programmer’s happiness over raw computing efficiency. This recently released book will help you understand performance pitfalls and how to squeeze every last bit of speed, from an otherwise somewhat slow language.

Metaprogramming Ruby 2: Program Like the Ruby Pros by Paolo Perrotta

Ruby Books: Metaprogramming Ruby 2One of the most powerful features in Ruby is its metaprogramming prowess. This book fully explores Ruby’s metaprogramming capabilities and does so with clarity and conciseness. At some point in your Ruby career, you’ll want to explore DSL (Domain Specific Languages) or understand how some Ruby on Rails gem manages to pull a certain magic trick. This book will tell you how and show you how powerful and flexible Ruby can really be.

Ruby Under a Microscope: An Illustrated Guide to Ruby Internals by Pat Shaughnessy

Ruby Books: Ruby Under a MicroscopeThe best and most advanced book on the market to really understand the internals of Ruby. At some point, you really owe yourself to peek behind the curtain. This the book I’d buy as a gift to my friends who are Ruby experts with over a decade of experience.

Ruby Courses

Some people prefer to learn by taking courses instead of reading books. If that’s you, if you might be looking for a great Ruby course. I have two to recommend. These two recently updated courses were created by Mike Clark and Nicole Clark at The Pragmatic Studio. They are particularly useful if you intend to take their excellent Rails course as well.

Fine print

  • Some good books were excluded because objectively too obsolete at this point. Too niche Ruby books were not included either.
  • The books mentioned above are some of what I consider to be the best Ruby books available today, based on my experience, those of my colleagues and possibly the opinions shared by most in the Ruby community. There are plenty of good books published every year, though, and if you’ve bought any of them or intend to buy one, you will probably be very satisfied nevertheless. That said, be aware that amongst the huge number of Ruby books being sold on the shelves at the moment, there are a few bad apples that I wouldn’t recommend at all. I won’t name such titles here but beware and read Amazon reviews if you decide not to stick to my recommendations.
  • Books are very helpful and you should definitely read them and keep a few on hand for reference. Remember though that in order to succeed at programming, there is no substitute for gaining experience by practicing coding yourself and reading other people’s code as well. They are necessary but not sufficient if you will.
  • I was one of the contributors to the Ruby Cookbook, but my judgment of that particular book is in no way altered by this fact.