A newbie's view of Ruby on Rails

2009/01/18

Categories: GeekStuff

I’m doing a project, and I think I’m going to try to do it in Rails.

Downsides: I don’t know Rails, and I’m pretty much a Ruby novice.
Upsides: It’s not PHP.

Since I have a fairly strong and diverse programming background, I think my experience of Ruby and Rails may be of interest to some readers, so I’ll try to update with impressions, code trivia, and such as I go.

Special thanks to fearoffish (an IRC nick) for some tips on books to start with.

If you’re a geek and you don’t know Ruby, I recommend it. From what I’ve seen, here’s how I’d suggest going about it:

1. Pick up a copy (paper or electronic) of Programming Ruby: The Pragmatic Programmer’s Guide. The link’s to a fairly old version of the book; they’re currently doing a revision to cover the upcoming 1.9.

2. Start reading… wait. Before I tell you: You may hate this document. If you hate it, that’s okay. Don’t read it then. Some people hate it. Anyway, start reading Why’s (Poignant) Guide to Ruby.

A bit of a digression is in order. The first time someone pointed me at Why’s guide, I read it for about three minutes, and got very upset and gave up. This guide was absolutely the worst way to explain the language to me, because it’s full of cutesy stuff, digressions, the sorts of apparently-random emphasis that makes me think of Dr. Bronner’s soap, and very little in the way of a very quick, technical, overview of what Ruby is and why I should care.

It made me think that Ruby was some crazy cult, like Dr. Pepper. It didn’t make me want to learn or use the language; it made me think the language was crazy.

But… It turns out that for many people, this guide is a good way to get into a receptive state to learn about Ruby. So give it a look.

3. Grab a copy (it’s already installed if you’re on a Mac!) and just start typing.

Ruby’s an expressive language. It’s not a language which makes any effort to keep you from being an idiot. It does little or nothing to protect you from your own stupidity. If you want to replace core functions of fundamental built-in classes, Ruby won’t even TRY to stop you. However, it is very good at letting you say what you mean, without having to say a whole lot more on top of it.

Rails? Uhm. I think Rails is a framework. Which is a fancy way of saying it’s a bunch of glue code, the intent of which is to make it easy to hook up database objects to code which wants to use them, and hide all the internals from you. Good idea.