[oak perl] Draft Review of Programming Ruby

Zed Lopez zed.lopez at gmail.com
Tue Nov 15 22:44:00 PST 2005


Hi folks,

This is a draft of my review of Programming Ruby, which I've owed
George for too long. Please let me know any comments you might have.

Programming Ruby, second edition by Dave Thomas with Chad Fowler and Andy Hunt

When Dave Thomas and Andy Hunt, authors of The Pragmatic Programmer,
published the first edition of Programming Ruby in 2000, it was the
first English language Ruby book. Ruby documentation was so scant that
they had to study the source code to do it, as Ruby's author, Matz,
explains in his foreword. For 2005, they revised it to cover Ruby 1.8,
the latest major release.

Though there are now several other Ruby books, Programming Ruby is
still trying to do it all -- language tutorial, language reference, a
guide to thinking in Ruby (which includes thinking in objects), and an
introduction to the Ruby community's conventions. The book's broader
than it is deep, but, given its breadth, that's praising with faint
damns.

It's not a book for a programming novice, but the language tutorial
was thorough and clear. Moderately experienced programmers should have
no problems with it. If you've done object-oriented and functional
programming before, it'll be easy going.

I was impressed by how the book includes what you need to actually
_develop_ in Ruby -- trying code snippets in the interactive Ruby
shell, debugging, watching out for Ruby's gotchas, developing a test
suite, documenting (in Rdoc, a Ruby standard), packaging code into a
Ruby Gem (RubyGems is Ruby's equivalent to Perl's CPAN), profiling
your code to find the slow parts, and how to extend Ruby in C to speed
them up.

There's a brief survey of Ruby's standard classes for web programming,
Tk, and the Windows API. The book's breadth exceeding its depth is
most obvious here -- for instance, 18 pages on web programming doesn't
just cover basic CGI, but touches on cookies, session maintenance, two
template systems for HTML generation, eruby (a means of embedding Ruby
in HTML, like PHP, Mason, PSP, or any of the other *SPs), SOAP, WSDL,
and the Google API. (Ruby on Rails is only mentioned as a framework
"currently attracting mindshare in the Ruby community.")

For all their brevity, these chapters were useful. First, they're a
starting point for learning available tools for those problem
domains. More importantly, they demonstrate the breadth of the
standard library and other available packages, and provide a lesson in
looking for existing solutions first. That's old hat to people used to
the open source world, but that's not everyone -- there are
programmers for whom it's still a radical concept.


Almost half the book is a reference to the built-in classes and
modules, and to the standard library. Ruby has dozens of built-in
classes, each, typically, with dozens of methods, so it's no surprise
that a lot of information went unmentioned in the language tutorial
and is only to be found here. In my use of the reference so far, I've
found it clear and well-organized.

Perl played a substantial part in inspiring Ruby. Likewise, it struck
me that Programming Ruby explicitly took some inspiration from
Programming Perl. It's even nicknamed for its cover illustration --
the PickAxe Book. Like the Camel Book does with Perl, the PickAxe Book
goes beyond the language at hand to advance principles of good
programming, like code reuse, writing for maintainability, and
avoiding reinventing the wheel. And it's all written with an
infectiously joyful spirit of programming being fun (and all without
reliance upon, say, grafting Monty Python references onto the code
samples.)

This book left me excited about the prospect of programming in
Ruby (and feeling capable of it.) What more could I want?


More information about the Oakland mailing list