TITLE: Ruby Tuesday
AUTHOR: Eugene Wallingford
DATE: April 01, 2008 5:45 PM
Is anybody home? After a flurry of writing from SIGCSE, I
returned home to family time and plenty of work at the
office. The result has been one entry in ten days. I look
forward to finishing up my
but they appear to lie forward a bit, as the next week or
so are busy. I have a few new topics in the hopper waiting
for a few minutes to write as well.
One bit of good news is that part of my busy-ness this week
and next is launching the third iteration of my
language topics course.
We've done bash and PHP and are now moving on to Ruby, one
of my favorite languages. Shell scripting is great, but its
tools are too limited to make writing bigger programs fun.
PHP was better than I expected, but in the end it is really
about building web sites, not writing more general programs.
(And after a few weeks of using the language, PHP's warts
started to grate on me.)
Ruby is... sublime. It isn't perfect, of course, but even
its idiosyncrasies seem to get out of my way when I am deep
in code. I looked up the
definition of 'sublime',
as I sometimes do when I use a word which is outside my daily
working vocabulary or is misused enough in conversation that
I worry about misusing it myself. The first set of definitions
have a subtlety reminiscent of Ruby. To "vaporize and then
condense right back again" sounds just like Ruby getting out
of my way, only for me to find that I've just written a
substantial program in a few lines. (My favorite, though, is
"well-meaning ineptitude that rises to empyreal absurdity"!)
This is my first time to teach Ruby formally in a course.
I hope to use this new course beginning as a prompt to write
a few entries on Ruby and what teaching it is like.
There are many wonderful resources for learning about and
programming in Ruby. I've suggested that my students use the
as a primary reference, even if they use the first edition,
a complete version of which is available
In today's class, though, I used a simple evolutionary example
Everyday Scripting with Ruby.
I hesitated to use this book as the student's primary source
because it was originally written for tester's without any
programming background, and my course is for upper-division
CS majors with several languages under their belts. But
Brian works through several examples in a way that I find
compelling, and I think I can base a few solid sessions on
one or two of them.
This book makes me wonder how easy it would be to re-target
a book from an audience like non-programming testers to an
audience of scripting-savvy programmers who want to learn
Ruby's particular yumminess. I know that in the course of
writing the book Brian generalized his target audience from
testers to the union of three different audiences (testers,
business analysts, and programmers). Maybe after I've lived
with the book and an audience of student programmers I'll
have a better sense of how well the re-targeting worked. If
it works for my class, then I'll be inclined to adopt it for
the next offering of this course.
Anyway, today we evolved a script for diffing to directories
of files for a tester. I liked the flow of development and
the simple script that resulted. Now we will move on to
explore language features and their use in greater depth.
One example I hope to work through soon, perhaps in conjunction
with Ruby's regular expressions, is "Finding Things", Tim Bray's
Oh, and I must say that this is the first time that one of
my courses has a
-- and a fine theme song, indeed. Now, if only someone would
create a new programming language called "Angie", I would be