Skip to main content

Get Started with Ruby

There are 3 stages to getting started with Ruby:

  1. Installing
  2. Learning the Language
  3. Learning the Tools

Learn This First

I've pulled together some great resources here, but that's all they are: resources. They exist to let you know what you need to practice. No amount of reading or video-watching will get the knowledge into your fingers where it needs to be for you to create stuff using Ruby.

Several of the resources force you to do the stuff they're trying to teach you before they let you go on, and this is the greatest invention in the history of teaching.

So I'll warn you right now: if all you do is read, you haven't learned a thing. Until you can do it, without referring back to the book or your notes or whatever, you haven't learned a thing.

Learning to program is like giving yourself superpowers. So when you learn to fly, go fly for crying out loud!

Installing

This used to be a trauma, but the good folks at One Month Rails have a solution I’ve heard nothing but good things about called Install Rails, that works for Mac OS X, Linux and Windows. It installs the standard set of dev tools every Ruby developer needs, even Sublime Text!

Learning the language

I advise learning the basics of Ruby (the language) before you dive into Rails (the dominant web application framework), so you don’t get trapped in “cut and paste” development, basing all your projects on bits you’ve found on the Net.

Absolute Beginners

Try Ruby walks you through a 15-minute tutorial that gives you a good taste of what Ruby is like. It’s a small bite for the curious and people who want to “try before I buy” (and run through the Rails Installer process).

Chris Pine has an excellent book called Learn to Program that uses Ruby as the platform to teach basic programming skills. The book itself is published by the Pragmatic Programmers, but his original tutorial is available for free on the site, though he emphasizes that the site is “unchanged since 2004” so I highly-recommend purchasing the actual book.

Jumpstart Lab have an extensive set of tutorials aimed at turning you into a well-rounded Rails programmer. Their Ruby in 100 Minutes is another great free beginner resource.

Experienced with programming, but not with Ruby

Learning a second (or tenth) programming language is like learning a second human language: you want to know “how do you say that in Ruby?” so you can do the things you’re used to doing in your old language. Ruby has a number of “ruby idioms” that will take your programming to a new level (read up on Enumerable for a sample), so make sure you don’t just learn some basic syntax and assume you’ve learned Ruby.

A good way to dig into the guts of Ruby and gain some testing skills (very big in the Ruby community) at the same time is the Ruby Koans Project. You make the tests pass by fixing the intentionally-incorrect ruby code embedded in the project. Very enlightening and fun to follow.

Learning the Tools

Many people come to Ruby via Rails, so they get the mistaken impression that Ruby is just “the language that lives under Rails”, which is missing much of the power and potential of the language. Ruby != Rails

Having said that, once you’ve got your feet under you with the language, you’ll probably want to find out about Rails, which is indisputably the “big dog” in the web application space.

One innovative free resource is Code School’s free Rails for Zombies online course. It takes a light-hearted approach to basic Rails programming with built-in exercises.

A (much) bigger bite is Michael Hartl’s epic Rails Tutorial which is available in free HTML format or as a 15-hour, paid PDF/screencast combination.

Another popular web app solution for Ruby is Sinatra, which takes a much more stripped-down approach. Definitely worth investigating.

Testing (especially “Test-Driven Development”) is a requirement in the Ruby community, and the place to start is RSpec. Even though RubyKoans (mentioned above) is based on Test::Unit (aka, MiniTest), RSpec is definitely the most-popular test suite for Ruby and Rails.

GitHub, which you will have run into during the Rails Installer process is the place to go for ruby code. All the source for essentially every gem (ruby library) in existence is on here somewhere, so when you start wondering how to use that great new gem or why it does something a certain way, look it up on GitHub. No self-respecting rubyist would be caught without a GitHub account. Mine is here. Reading other people’s code without having them there to explain it to you is a great way to learn new tricks and ways to think about programming. Pretend you’re a detective and the code hides your clues: follow your leads until you figure out “whodunit”. :-)