Web Development

Learn Ruby with these 10 books and other resources

Finding the best resources when learning any programming language is not always easy. Chad Perrin makes this process easier for experienced and novice programmers interested in learning Ruby. He recommends 10 great Ruby books as well as other resources.

Learning to program, or just learning to program in a new language, can be a challenge if you cannot find the right introductory and reference materials. Some languages make it easier than others, but in a perfect world, you would always have the right introductory and reference materials available.

Fortunately for anyone who wants to learn Ruby, there are a great many learning resources available. The trick is finding them.

Online Ruby documentation

The world is getting better about providing learning materials for programming languages for free, thanks to the efforts of volunteers and vendors. It is increasingly often the case that you can find class, method, and function documentation for language primitives and standard libraries, as in the case of a Web-based collection of documentation for the Ruby language at Ruby-Doc.org. In fact, if you need documentation with examples for any core class in Ruby, the simplest of Google searches will typically lead you directly to documentation on this site. Just enter ruby array into the Google search box, for instance, and the top hit will almost certainly be the array documentation at Ruby-Doc.org.

It is also increasingly common to find documentation at your fingertips on your local system, as long as you have the standard distribution of the language's reference implementation installed. For instance, the ri tool for Ruby can give you information similar to what you would find at Ruby-Doc.org; the following is the output for the command ri Array.to_s:

------------------------------------------------------------- Array#to_s

array.to_s -> string

------------------------------------------------------------------------

Returns _self_+.join+.

[ "a", "e", "i", "o" ].to_s #=> "aeio"

Doing a Google search for Ruby tutorial, Ruby introduction, or Ruby howto is likely to return more results than you can use, too. Unfortunately, such options are usually less than ideal; online tutorials typically only barely scratch the surface.

The Ruby community

Language communities can be a great help as well -- as long as your language of choice has a good community. Ruby's community is among the best. In particular, the ruby-talk mailing list is a great place to go for interactive help from fellow Rubyists, though there are several other mailing lists related to the Ruby language and its community. You can find a signup form for the ruby-talk, ruby-core, ruby-doc, and ruby-cvs mailing lists at the Ruby Programming Language Mailing Lists page. The ruby-talk list is the primary list for the community, and there are also newsgroup and Web forum gateways to the list in case email is not your preferred form of participation with an online community.

The Ruby Programming Language Community page also offers information on local user groups that have actual meatspace meetings, an IRC channel, Weblogs about Ruby, conferences around the world, and even a mentoring project that tries to help link up new programmers and experienced programmers in mentoring relationships.

There are other subcommunities as well, such as those particular to specific development frameworks -- including the (in)famous Ruby on Rails Web application framework. There is a Ruby on Rails Community page with links and information for a variety of community resources particular to Rails.

10 great Ruby books

Ultimately, books are often among the most important resources for quick, in-depth introductions to a language. The best books to use for introducing yourself to a given language will depend on the language, and also on the person trying to learn it. While different learning styles can really make it difficult to nail down the perfect lineup of books, it is usually the case that a well-written book will be at least good, if not perfect, as a learning tool. With the right set of books, a little diligence, time, and the tools and inspiration to practice programming in the language, you can work your way up from neophyte to competent coder.

A list of good Ruby books for people new to the language includes:

  • Agile Web Development with Rails by Sam Ruby, Dave Thomas, David Heinemeier Hansson, et al.: A lineup of august personages (including Thomas, one of the Pragmatic Programmers, and Hansson, the inventor of Rails) in the realm of Ruby development in general, and Rails development in particular, makes this a go-to book for those who wish to delve into the realm of Web application development using one of the hottest Web frameworks available. The first edition of this book (which rests on a shelf near the computer where this article was written) was the first, definitive, and canonical text about the Rails Web application framework.
  • Everyday Scripting with Ruby by Brian Marick: This book is oriented toward technically proficient people, though not necessarily toward expert programmers. Despite this, even expert developers may find Marick's simple explanations of idiomatic Ruby programming illuminating. It is relatively low-impact, in that the author's introductions to concepts of Ruby programming (and test-driven development) are engaging and easy to follow without being so elementary as to be useless to anyone beyond the freshest novice. It serves as an excellent introduction to Ruby for anyone with at least some technical chops who needs a book or two as a place to start.
  • Learn to Program by Chris Pine: This is, in essence, the canonical Ruby-based introduction to programming for people who have never written a line of code in their lives. It starts out incredibly simple, and eases the new programmer into the concepts of automating tasks on a computer via the Ruby language.
  • Metaprogramming Ruby by Paolo Perrotta: The most advanced Ruby programming techniques will always be those some true luminary of the language is probably inventing right now, but for an introduction to the heady heights of true Ruby expertise, you could do far worse than this book. Metaprogramming can be defined loosely as writing programs that write or modify programs -- especially themselves. While this may eventually be the only kind of programming we do, for now it is highly advanced stuff, and this book provides a lucid, comprehensible, and eminently practical introduction to such techniques in the Ruby language.
  • Programming Ruby by Dave Thomas, with Chad Fowler and Andy Hunt: Also known as The Pickaxe Book, because of the pickaxe image on its cover, this is generally considered the definitive reference for programming in Ruby. It was the first major Ruby book to be published, and was written and published by the authors of a timeless classic of good programming practice, The Pragmatic Programmer.
  • Ruby Best Practices by Gregory T. Brown: This is no simple explanation of preferred whitespacing, naming, and scope management conventions. Brown uses examples from real, well-written Ruby libraries and applications to demonstrate how the best Ruby programmers think when they write code, and how the reader can approach writing code in Ruby to achieve similarly beautiful, effective results.
  • Ruby in a Nutshell by Yukihiro Matsumoto: Ruby creator Yukihiro Matsumoto, also known affectionately as "Matz" in the Ruby community, wrote this desktop reference for the Ruby language. Books like Programming Ruby and The Ruby Programming Language take a guided tour approach to offering reference material on the language; O'Reilly Media's Nutshell book series takes the approach of organizing information about a technical subject in a manner that is optimized for quickly looking up specific details to refresh the experienced programmer's memory about how specific language constructs work. For those who want this kind of reference book on their desks, the O'Reilly Nutshell series is hard to beat.
  • The Ruby Programming Language by David Flanagan and Yukihiro Matsumoto: This book is decorated with illustrations by legendary -- and now missing -- whimsical Ruby programming master Why the Lucky Stiff. It is exactly what one should expect from a language reference written by its creator, a well-respected programming text author, and a developer who injected a lot of the spirit of fun into the community that flavors it even now, about a year and a half after he vanished from the Internet. Why the Lucky Stiff's cartoon creations have become mascots for the language, and his disappearance inspired a day of remembrance and joyful coding called Whyday.
  • The Ruby Way by Hal Fulton: Organized in the manner of a "cookbook," the real value of this book is not drop-in code snippets or hints about what libraries to use for particular tasks, though these are benefits the book provides. The most important thing this massive tome of Ruby wisdom offers is its demonstration of how to write idiomatic Ruby code that leverages the beauty of its syntactic and semantic model to produce extensible, maintainable, elegant code.
  • Why's (Poignant) Guide to Ruby by Why the Lucky Stiff: As described in the entry for the Pickaxe above, why was a unique individual in the Ruby community, and his contributions pushed the boundaries of people's conventional approaches to programming. It helped us all broaden our perspectives on software development, and helped many of us rediscover or enhance our joy in the art of coding. One of the ways he did this was this digital book, released for free on the Internet, still available from a variety of sources. A Google search for why's poignant guide should provide ample results to get you on your way to discovering this lighthearted introduction to the language. Unfortunately, it seems likely to become less and less relevant to learning the technical details of Ruby programming as the language evolves in years to come, but the delight in the act of programming that it imparts should remain as potent 10 years from now as it is today.
The five Ruby books you should get first

Even focusing on only five books, at least two lists need to be presented to serve the needs of both brand-new programmers and people coming to Ruby from other languages. These lists are numbered in the order in which you should probably get the selected books. As you progress through a list, it is expected that, if your needs begin to diverge from the assumptions about what you may need from a given list, you will evaluate those needs and make changes to the list. As more books are published, some of these selections may even become obsolete, or at least less important than newly published works.

For experienced programmers:

  1. Everyday Scripting with Ruby
  2. Programming Ruby or The Ruby Programming Language
  3. The Ruby Way
  4. Ruby Best Practices
  5. Metaprogramming Ruby

For novice programmers:

  1. Learn to Program
  2. Everyday Scripting with Ruby
  3. Ruby Best Practices
  4. Programming Ruby
  5. The Ruby Way

There is significant overlap in these lists, and not all the titles in my recommendations of great Ruby books are represented. This is because some of the great books about Ruby are too specialized to be particularly suitable to general purpose Ruby programming, or are simply not likely to be suitable to an instructional track for many readers, even if they are wonderful books.

When learning Ruby, you will likely find that the one guiding principle that most helps you progress is simply this: follow your enjoyment of the language. Yukihiro Matsumoto has said that one of the most central motivations in developing the Ruby language is to help make programming enjoyable. With that in mind, it seems likely that if you are not enjoying the use of the Ruby language, you are doing it wrong.

More programming resources on TechRepublic

About

Chad Perrin is an IT consultant, developer, and freelance professional writer. He holds both Microsoft and CompTIA certifications and is a graduate of two IT industry trade schools.

16 comments
andolasoft
andolasoft

Nice Blog for the all users. I think it should be more helpful for the .Net programmer.

Tony Hopkinson
Tony Hopkinson

Our place has chosen Ruby on Rails as the recomended standard for it's online initiatives, so hopefully I'll need to know something about it. Quick visit to the book shop to expand my reference library coming up. I shall look for these titles.

jcasimir
jcasimir

"Learn to Program" is awesome if you're new to programming, and "Metaprogramming Ruby" is great for experienced hackers. If you'd like live, in-person training, though, you should come to one of my classes! I teach Intro Ruby, Intro Rails, Intermediate Rails, and Intro jQuery. Check it out at http://jumpstartlab.com. All classes have 110% money-back guarantee.

Justin James
Justin James

What I've learned and seen of Ruby so far, I really like! I just wish I had the time to do all of this reading! J.Ja

apotheon
apotheon

Can you offer a ballpark estimate of what classes cost, in case someone is interested and happens to be in an area where you give classes? As far as I'm aware, you don't teach these classes anywhere near any of us who have commented here, so far.

Sterling chip Camden
Sterling chip Camden

... usage trumps reading. But the reading helps fill in the gaps, and spawn new ideas.

Justin James
Justin James

... but it is indeed there: http://jumpstartlab.com/custom Also, the site says that he'll come out to anywhere that you want so long as you have 6 attendees. The pricing is not unreasonable compared to other in-person training classes I've looked at. And Raleigh is a 4 hour drive from me, that's as close to "nearby" as it gets for stuff in my neck of the woods... J.Ja

apotheon
apotheon

My temperament seems to be well-suited to alternating between autodidactic pursuits -- reading, coding, getting some mentoring from others, wash, rinse, repeat. Most of the time, I do without the mentoring (since it's so difficult to find anything like that aside from the pseudo-mentoring of formal classes, which cost money and time), but switching between reading and practicing, with the longer periods being the practicing, seems to work quite well for me.

Justin James
Justin James

Ruby is such a foreign land to me (as is F#) that I want to do a lot of reading on them to get the most out of them. I've spent way too much time buried in the .NET ecosystem. :( J.Ja

apotheon
apotheon

I appreciate the additional information.

jcasimir
jcasimir

Private classes are $2500/day, generally. My intent with the post, though, was to refer to our public classes. Those are under $250/day/person and usually two days. I'm pretty open to traveling; for instance I'm running sessions in Nashville, SF, and Seattle within the next week. It takes about six attendees for me to make a break-even trip and classes are capped at 12.

apotheon
apotheon

I'm unclear on whether "RailsJumpstart: Intermediate Rails" qualifies as "Custom Training" -- and most of the courses he discusses on the site do not say anything about how long they are expected to take. I guess I'm just finding it difficult to get a handle on how much the specific courses he describes there are supposed to cost, and wondered if there was some key to applying his rates to those courses. Good point, re: a four hour drive. I was thinking more in terms of crossing state lines than length of a drive, I guess. I've lived in larger states a lot of my life, so the eastern seaboard's sense of scale is not my usual way of thinking about distances.

Justin James
Justin James

From what I can tell, I am currently on pace to do some sort of substantial work (as in: "a lot more than just checking my email") somewhere around 330, 340 days this year. I'm at the end of a 12 hour day right now. I watched 2 (that I recall) non-kids films in 2010. :( My non-working time is at a super premium at the moment. Then again, it's always subject to change. I think I'm at the tail end of a couple of contracts that have been murdering my Sundays. My big, BIG goal right now is to plunge into IronRuby + WP7. I just got a WP7 phone (absolutely LOVE it!) in a contest, so now the apps I've been writing are actually useful to me. Mixing IR with WP7 strikes me as a particularly good idea and a lot of fun, assuming there are no technical surprises. J.Ja

apotheon
apotheon

I encourage you to learn the stuff that feels foreign. As I'm sure you know, stretching and exercising the mind keeps it limber, healthy, and fit. My major problem with learning new things is finding the time to do it, though.

Editor's Picks