Chad Perrin: SOB

31 January 2007

Oh, to be a (Ruby) virgin again . . .

Filed under: Geek — apotheon @ 02:09

A while back, I started learning Ruby. It really captured my interest, and struck me as a particularly elegant language. One might say it is “beautiful”, in a way that few languages can (reasonably) claim.

I didn’t get terribly far. I’m in no sense really competent in the language. I got derailed in the process of learning Ruby by other things that, unfortunately, required my attention. Thus, it got set on the back burner to simmer.

It has boiled down to nothing. All the water evaporated from the pot. All that’s left is a little bit of mineral sediment (see, I told you I should have used distilled, rather than tap, water). There’s naught left but a residue of what little I had already learned.

I’m almost a complete newbie to the language again, and I’m once again looking at the possibility of really learning the language. This time, though, I’m not going to just dive in head-first without thinking about how best to get anywhere.

I know at least a couple of my readers — at least one of which is a regular reader — know the language well enough to be able to offer some advice on the subject of how best to go about learning Ruby, pretty much from scratch. I have a copy of Agile Web Development with Rails on my shelf, and would prefer to avoid spending any more money on Ruby books for a while, though I might be persuaded to make an exception if the argument is strong enough for doing so.

So . . . what would be the most efficient and interesting way to gain competence as a Ruby programmer? Where should I start, and where should I go from there?

I rather suspect that my personal proclivities would lean toward one of two paths for learning:

  1. web development — I might be able to make use of Ruby for web development as a way to steep myself in the language’s knowledge, as this would provide me with a real-world, immediate use for the language that would keep me hacking Ruby code, assuming I have the references and instructional materials to help propel me along that path.
  2. command line automation scripts and utilities — I have discovered that command line arguments, data munging, and simple I/O for command line programming (such as sysadmin scripts) provided the most helpful path to learning Perl to any level of competence. Perhaps the same approach would suit me for Ruby.

If you have suggestions for approaches to learning the language that involve database access and a means of easing me into OOP with Ruby, that too would be welcome — though again, I think that real-world applicability would be of paramount importance, early and often, in the practice aspect of the learning path.

A problem I’ve discovered with most programming instructional texts is that they waste a lot of up-front time talking about language functionality that nobody uses in the early stages of learning the language when they want to write something they’ll actually use. As such, the more important aspects of the language for such projects get neglected. For instance, almost every programming instructional text in the world teaches an input loop of some sort as the first form of program input, and many of them not only don’t get to taking command line arguments very quickly, but sometimes don’t get to it at all, ever. Even those that do often fail to explain the “right” way to do so — for instance, some Perl texts will do a cursory job of explaining the @ARGV array, probably in an appendix or footnote, but never explain anything about using Getopt::Std and Getopt::Long. Please think about these issues when considering suggestions you might offer me.

Your responses don’t have to be here, if you have any advice to offer — if you have another means of contacting me and prefer that as a means of getting the information to me, I’ll be grateful for that as well. Do it however you think works best. I just hope someone can offer me some advice that will get me on a path that won’t prove overly frustrating. One of the reasons Ruby got back-burnered in the first place was the disconnect in the relation between most of the documentation and instructional materials I found, and where the rubber meets the road, so to speak. I don’t want to stall out when I tackle the subject again.


  1. One good resource is Programming Ruby, the Pragmatic Programmer’s Guide (full text online). It gets up to speed pretty quickly and acts as a good reference as well. I still use it.

    For a good Rails tutorial (even though its getting some age on): see

    I’m sure that assaf could suggest something good.

    I’d recommend wading through my code samples, but then I’m kinda a rubynuby myself.

    Comment by Sterling Camden — 31 January 2007 @ 02:26

  2. Thanks for the information. The bit about the Pragmatic Programmers’ book getting “up to speed” quickly certainly gets my attention.

    Comment by apotheon — 31 January 2007 @ 02:34

  3. Sorry that the tutorial is so Windows-oriented. You’d have to translate for BSD.

    Comment by Sterling Camden — 31 January 2007 @ 02:47

  4. No problem. It’ll probably work out for me, as long as the actual programming-oriented stuff isn’t OS-specific. I’ll have to give it a more thorough look, I guess, than the initial glance I’ve given it so far.

    Comment by apotheon — 31 January 2007 @ 04:11

  5. Learning how to build apps with Rails, won’t teach you Ruby. All you’ll pick up is the syntax, but you’ll still be programming in a language you already know. But let’s assume you only have one book and want to make the most out of it: learn Rails (useful in its own self), build something with it, then read the Rails source code. Rails uses possibly every Ruby technique, has some real gems there, and, when there’s more than one way to do something, picks the better option.

    I only read the Pickaxe book (aka Pragmatic’s Programming Ruby), first online and then bought the second edition in PDF, which is more recent. It teaches you Ruby, not programming, so no time wasted learning what a variable is. It’s one of the better books I’ve read, although, that’s not saying much. It will mention ARGV along with all other global variables, and has an appendix covering all the essentials of the standard library, including OptParse. One page, but you’ll know it exists and what it’s good for. I think it’s an excellent book for beginners and as reference for later on.

    The Pickaxe book is great for learning the OOP aspects of Ruby, how it handles module mixins, singleton methods, etc. It won’t teach you anything about database access, you’ll want the Rails book for that.

    I learned Ruby by starting with something I needed that wasn’t on the critical path. I wasn’t expecting to love the language, I just needed to solve a problem and figure I can learn it on the way. I ended up trying to solve every other problem with Ruby :-)

    Comment by assaf — 31 January 2007 @ 06:03

  6. Thanks, assaf. That’s definitely some useful depth.

    I wonder — do either you or Sterling have any opinions about any of the other beginning Ruby texts out there, on the web or off it, besides the Pickaxe book?

    Comment by apotheon — 31 January 2007 @ 07:16

  7. I almost forgot! I keep recommending Pickaxe because I learned from it, and still keep it handy as reference.

    If you’re looking for an introduction, and don’t mind reading a fun book, check out The Humble Little Book:

    And yes, it also covers database access and networking.

    Comment by assaf — 31 January 2007 @ 11:00

  8. Excellent! The Humble Little Ruby Book looks like a good’un. Thanks again.

    Comment by apotheon — 31 January 2007 @ 11:37

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License