Getting started in Ruby
Coding, Web 2 Comments »
So one of my New Years resolutions was to learn Ruby, and make a website in Rails. Actually, I’ve challenged myself to make a new site every 2 months in 2007. I’m not doing too well for Jan-Feb, but I’ve made my first website project my class final for the Database Design grad class I’m taking. The class ends at the end of Feb, so I guess I’m going to have to be on time!
I’m using Ubuntu Edgy Eft (6.10) and have no prior knowledge of Ruby or Rails. I figured I’d post here and let all you other want-to-be-ruby/rails developers how to get started, based on my experience on what hasn’t worked in my last 2 weeks of learning Ruby and Rails.
There’s a lot of tutorials out there, and most of them are difficult to understand. Unfortunately, genius programmers sometimes have a difficult time explaining complex subjects in human-ese.
So here’s my attempt to point you in the right direction:
1. Get Ruby installed. If you’re on Windows, go grab the installer. If you’re on Linux or OSX, you can throw a command or two at the terminal:
- Linux: sudo apt-get install ruby irb rdoc
- Mac (MacPorts): port install ruby
2. OK, so we have Ruby and we have Rails, time to jump in, right? Not exactly. Ruby takes Object Oriented Programming to the extreme, so you’d better be very, very familiar with the ideas of OOP, Classes, Objects, Inheritance, and so on. If you’r not, keep reading Wikipedia until you are. You might want to look into data types (string, integer) and other concepts like arrays.
Ruby isn’t hard, the concepts behond Ruby are hard. If you’re a CS or IS major, you probably has a semester or two to figure this stuff out, but I found it a good reminder just to read through the Wikipedia article on OOP anyway, Ruby is severely into objectification. (even an integer, like “1″ is considered an object – yeah, I know…like I said…crazy objectification)
3. OK, so now we’re ready to get started. The best tutorial I found, and the only one that seemed to clearly describe Ruby from the ground up is Learn Ruby on Rails: the Ultimate Beginner’s Tutorial by Patrick Lenz. It just came out about a week ago, and just in time. Read through it. Slowly. Do the examples in your own Ruby shell. (for me, I got in the Ruby shell by typing ‘irb’ on Ubuntu’s command line). Do the examples along with the tutorial. Did I mention the examples?
If you have previously programmed in C/C++, Java, Perl, PHP or Python, you might want to have a look at how Ruby compares to those languages to get a better understanding of why (or why not) you might want to switch over.
4. Alrighty, so now we’re all official Ruby Newbies. Where to go from here? I mean the examples in the tutorial were good, but the tutorial definitely didn’t tell us everything you can do to a text string, for example. And what about all the weird stuff you can do to an array? Well, Ruby comes with a manual, and the download over at ruby-doc.org has a bunch of other great stuff too. The manual is for version 1.4, but it still will serve you well.
Good luck!
Have fun getting started and playing with Ruby, I’ll be posting my experiences as I go along.

Entries