Poignant Guide to Ruby

Monday 23 February 2004This is close to 21 years old. Be careful.

Everyone’s linking to why’s (poignant) guide to ruby, and everyone seems to love it. Maybe I’m just an old fart, but it struck me as the work of a precocious and irritatingly cute tween-ager. I’d love to have more about Ruby and less about the author. Somebody get this guy an editor.

Comments

[gravatar]
Yeah, it is kind of annoying. But at least it's different... :-)
[gravatar]
"greenish red"? Is that like bluish yellow? Pinkish black?
[gravatar]
I am so tired of "[A language] for Beginners". There are so many programmers that do NOT need to learn what a variable is.

Ruby is very simple to learn. But there are some areas that are more complex underneath (closures) and quite complex (continuations).

When I need a technical book, I look for "Advanced" in the title. The elementary stuff is usually implicitly assumed, or can easily be looked up on the web. That is easier than skimming through pages of "hello world" programs.

I learned Ruby from The Pragmatic Programmer's Guide a couple of years ago, and I program in it almost exclusively now.
[gravatar]
Yeah, the "cleverness" is over the top. "The Little Schemer" works, "Learning Perl" works. But to bludgeon someone with "READ THIS PARAGRAPH...THIS ONE TOO...NOT THIS ONE" right from the get-go just gives me a headache.

But I have to say that I'm absolutely in favor of someone, anyone paying serious attention to producing an easily available, free, introductory text for novice programmers. Hopefully the attention will generate some input from more seasoned authorities, and maybe we'll end up with a great source of both knowledge and wisdom for beginners.
[gravatar]
I put it in a category like Mr. Bunny's Big Cup o' Java.. If you think it's a real guide to the language you're missing the point. It's an artistic creation themed around a programming language. Even in that context I agree it's not spectacular, although, I give them a lot of credit for creating something unique and colorful.
[gravatar]
It's certainly an entertaining read about Ruby. I especially liked the comics. Technical manuals need more comics, dammit!



I can't say it got me excited about the Ruby though. I don't know if it was just the examples, but I find Ruby to be almost as cryptic as Perl. For instance:



exit unless "restaurant".include? "aura"



The author talks about how the language makes good use of punctuation. It may make sense in Japanese, but in English, question marks go at the end of the sentence.



Python, on the other hand seems clearer:



if "aura" in "restaurant": sys.exit(-1)



His other example is even more confusing:



[toast, cheese, wine].each {|food| eat food}



What's going on here? Does the food eat itself? Again, Python is much more elegant (in my opinion, anyway)



for food in ['toast', 'cheese', 'wine']: eat(food)



I'll admit I'm a bit of a Python zealot and I should really learn about Ruby. But so far, Python is still king.



Nat

[gravatar]
I had to stop reading it, because I was snickering out loud. Not good when the cubicle walls are only 4 foot high. "why" is a wize-guy, and if you like his humour, you'll find his writing entertaining, and you'll learn something about Ruby. In that order.

If you find his "humour" grating, best not to read it.

[gravatar]
I take it all back. The comics are funny. The examples are funny. I'm going to get nothing done today.
[gravatar]
The inimitable Dave Thomas pointed out that the
for food in ['toast', 'cheese', 'wine']: eat(food)
code is syntactically correct ruby as well. You just need an end after that line to specify that your for loop is done. (you could also do it with brackets or (blecch) a semicolon if you really wanted to keep it on one line)

richs@ess richs $ irb --noprompt
def eat(food)
p "Tasty, #{food}"
end
nil
for food in ['toast', 'cheese', 'wine']: eat(food)
end
"Tasty, toast"
"Tasty, cheese"
"Tasty, wine"
["toast", "cheese", "wine"]

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.