Sunday, January 09, 2005

Thinking in Ruby ... not

People have been bugging me about Ruby again, suggesting I write "Thinking in Ruby." Here are some fragments and replies from one conversation. The writer is talking about available books:

The first is the "Pragmatic Programmers Guide to Ruby" ... This book isknown as the "PickAxe Book" and is the standard reference most Rubyists keep at the ready... The online version covers Ruby version 1.6.7. A newer version of the book has been released recently and is updated for the current version of the language (1.8.2 ) .

I know Dave and Andy, and we had a conversation about this -- like this reader, Andy said that he had tried Python and it never made sense to him. I think there are a set of people for which that is true, and I'm starting to see that Ruby is a good alternative for them, since otherwise they'd probably just be stuck in Perl.

The next reference material would be "Why's Poignant Guide to Ruby". This, by far, is the most unconventional piece of reading I've ever found, but it has enough humor interjected to keep people reading. It's a bizarre piece of work, but you may find it to your liking.

Yes, I saw this when it was just coming out. This guy is brilliant, and I hope that someday he might translate his work to Python. In fact, his work is one reason that I wouldn't try to compete on an introductory level. The only thing that could happen would be (maybe a couple of years down the road) a "Thinking in Patterns with Ruby" but that would only be after the Java, Python, and probably C# versions.

The last of the "standard" tutorials that I would refer you to (of the ones I've read myself) would be the Ruby tutorial that comes in the standard install. A copy is available through the Ruby Online Documentation website:

Having another world class author that got fired up and started releasing books would be wonderful ( The thought of a 'Thinking in Ruby' book is just too much ... )

I just don't see it happening, other than (only possibly) the patterns book, which would not be introductory (and patterns would be the level at which I would be interested in exploring the language, anyway). I'm very happily ensconced in the Python community, and every encounter I have had with Ruby -- so far -- has not made me see the power in it.

I find that it has a less-than-elegant syntax because of its Perl influence (but if you like Perl, perhaps Ruby is the right fit for you). Again, to a Perl programmer this might be a great improvement. Look at one of the first examples from "Why's Poigniant Guide," where he's asserting that Ruby is "the language of our thoughts":

5.times { print "Odelay!" }

Or this:

exit unless "restaurant".include? "aura"

This makes sense if you used to be a Smalltalk (or perhaps Forth) programmer, and I know one who started with Python and has moved to Ruby. It also makes sense if you grew up Pennsylvania Dutch, where they say things like "Throw Papa down the stairs his hat," and "Throw the horse over the fence some hay." (This theory has been confirmed by a Pennsylvania Dutch Ruby Programmer.)

Of course I only get bits and pieces, usually from people who don't know Python trying to convince me that Ruby is better, but so far as I've seen it doesn't have the more interesting features or libraries that Python has. There's only one programmer I know -- the aforementioned former Smalltalker, which I think was the major influence -- that might have had a really good understanding of Python (I don't really know if he did) that has moved to Ruby.

Nonetheless, someday when a seminar is being taught when I am available, (ideally one of Dave and Andy's) I will take it. I think that would be the best and easiest way to get a grasp on it. I find that learning new languages is always good for new insights into programming.

And it's certainly possible that I might like it. Hey, the first time I picked up a Python book (after two intense months with Perl had come crashing down upon discovering how lame references and objects were, which I suspect was a major impetus in the creation of Ruby), I threw it down, saying "Indentation to determine blocks? That's the most ridiculous thing I've ever seen!" I eventually picked up the book again. A couple of years later, I was responsible for that year's Python Conference T-shirt "Life's better without braces!" (cartoon of a smiling kid who had just gotten his braces off).

So who knows? But don't hold your breath; my plate is very full right now and Python is the most functional language I use, so at the moment it's sort of "when they pry my cold, dead, fingers off my Python documentation."

But hey, if Ruby pushes the right buttons for you, great. It's probably the tool that will make you most productive right now, and that's what you should use. It doesn't really matter whether I am a fan (yet).