This page is devoted to recommended books those who wish to learn how to program in Ruby. You can click here if you are looking for the best books on Rails. If you are looking into Ruby because of Rails, it is highly recommended that you get both a Ruby and a Rails book. If you are interested in pursuing the study of Rails as well, you can pick up the recommended reading from the Rails books page.
Ruby 1.8 or Ruby 1.9?
At this stage Ruby 1.8 is the most used version. That said, Ruby 1.9 brings a lot to the table in terms of improvements to the language and its performance. For those who are interested in Rails, Rails 2.x is best deployed with 1.8, while Rails 3 (which is expected soon) will also work well with Ruby 1.9.x. As per 2010, it is recommended that you learn both. If you wish you can start with Ruby 1.8 and then buy a book to guide you through the upgrade to Ruby 1.9. Switching from 1.8 to 1.9 shouldn’t be an issue if you have a solid 1.8 base.
Recommended Ruby Tutorial/Reference books ordered by difficulty level
Title: Learn to Program
Level: Absolute Beginner
Coverage: Ruby 1.8
This book is particularly good for absolute beginners because it requires no knowledge whatsoever of programming. Not only does it teach you the basics of Ruby, but also the essential concepts of programming. It’s an extremely affordable book (Amazon US sells it for $12) that’s also a quick read ( it’s about 170 pages). It is a solid introduction to programming in Ruby, and can’t be topped if you intend to go from an absolute beginner to having a higher level of confidence when it comes to programming. Pick up this book and work through all the exercises proposed within it to really get the most from what it has to offer.
Title: Beginning Ruby: From Novice to Professional, Second Edition
Level: Beginner
Coverage: Ruby 1.8 & 1.9
This is the best introduction to Ruby for novice/beginner programmers. It lays down solid foundations for the language, as well as nicely introducing the whole Ruby ecosystem. The author, Peter Cooper, is a well known figure in the Ruby community, and in this book he clearly shows his ability to teach and communicate with newcomers. The second edition was recently released and includes information about Ruby 1.9, as well as lesser known web frameworks like Sinatra and Ramaze. Highly recommended to beginners.
Title: The Ruby Programming Language
Level: Intermediate
Coverage: Ruby 1.8 & 1.9
The Ruby Programming Language by David Flanagan and Yukihiro Matsumoto (matz) is, simply stated, the best book on Ruby available on the market. It’s accurate, in-depth, and uses a reference style that doesn’t leave you with any doubts about the language. This book is co-authored by the inventor of Ruby (matz) and covers both Ruby 1.8 and 1.9. If you are an intermediate/experienced developer who is not afraid of understanding the subtitles of a new language, you can’t go wrong with this book.
Title: The Ruby Way (2nd Edition)
Level: Intermediate
Coverage: Ruby 1.8 & 1.9
The Ruby Way (2nd Edition) looks like a cookbook, and within its pages you’ll find plenty of how-tos for several common tasks. It is therefore a valuable book if treated as a cookbook, but that’s not the main purpose behind it. The Ruby Way is about learning how to deal with a variety of programming tasks in an idiomatic manner, it’s about taking your existing knowledge of Ruby and polishing it in order to apply it to both simple and complex scenarios. If it’s true that in Ruby there are usually several ways of accomplishing something (however to a lesser extent than Perl’s TIMTOWTDI principle), it’s also true that most developers will point out that there is often a best way of doing it. This book is about learning to code that “best way” in Ruby, the Ruby Way. This is the book from which David Heinemeier Hansson, creator of Rails, learned most of what he knows about meta-programming and Ruby. I personally consider The Ruby Way 2nd Edition to be a definite must-have, chock full of practical examples and advanced lessons.
Recommended Ruby Cookbooks
Title: Ruby Cookbook
Level: Beginner | Intermediate
Coverage: Ruby 1.8
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 and very 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 throughly 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 is bound to end up getting a lot use.
Title: Wicked Cool Ruby Scripts: Useful Scripts that Solve Difficult Problems
Level: Beginner | Intermediate
Coverage: Ruby 1.8
Wicked Cool Ruby Scripts is a short book that includes 58 scripts for solving several tasks ranging from system administration to web parsing to scraping, as well as more algorithmic examples and cryptography. The book is very accessible. Each script is carefully explained step-by-step in a manner that can be fully understood by beginners. The examples provided are fun, even though experienced programmers may find some of them a little on the basic side. Overall this is an enjoyable and recommendable cookbook that can be read cover to cover in a short amount of time.
Other essential Ruby books
Title: Design Patterns in Ruby
Level: Intermediate
Coverage: Ruby 1.8
This short (and sweet) book can be read in a matter of a few days, but it concentrates tons of advanced Ruby idioms, “best practices” and design patterns, and is not lacking in handy material. Design patterns vary from language to language. For example a few design patterns which are required in Java, become part of the built-in features of the Ruby language and its standard library. Design Patterns: Elements of Reusable Object-Oriented Software (aka The Gang of Four book) is an awesome book, but you will find that quite a few design pattern implementations are quite specific to C++ and similar languages; overall this book is also quite advanced and difficult for the average programmer. The idea behind “Design Patterns in Ruby” is to create a modern, smaller, and more Ruby specific introduction to design patterns. It’s an advanced text which explores all the fun stuff that Ruby provides programmers with, while still being accessible for those who are relatively new to the language. This is definitely not the book for a complete beginner though. However this title is nothing short of amazing, and it should accommodate the needs of anyone with an ardent desire to learn the ins and outs of the power of Ruby’s expressiveness.
Title: The Well-Grounded Rubyist
Level: Intermediate
Coverage: Ruby 1.9
I don’t own this book, so I can’t review it or endorse it first hand I received this book and will review it soon. I’ve included it here, as I heard positive things from trusted colleagues.
Title: Ruby Best Practices
Level: Intermediate
Coverage: Ruby 1.9
I don’t own this book, so I can’t review it or endorse it I received this book and will review it soon. I included it here, as I heard positive things from trusted colleagues.
The fine print (nah, just kidding…)
Updated: March 2010