At 564 pages long, this book aims to provide an introduction to
the Ruby language and a reference to the language, its syntax, and
standard library. The authors' first book,
The Pragmatic Programmer (Addison-Wesley, 2000), is a
compendium of practical software engineering techniques and
"tricks of the trade". Does Programming Ruby live up to
its authors' reputation? I think it does.
The book describes Ruby as "a true object-oriented programming
language that makes the craft of programming easier". In my opinion, Ruby takes
the best features of Perl, Python, and Smalltalk and combines them
into an excellent, flexible language. In Japan, Ruby's country of
origin, Ruby is now more popular than Python. However, one of the
problems with Ruby is the lack of documentation: since Ruby's creator
and many of the most experienced users are Japanese, finding English
documentation can often be difficult. This is a problem that
Programming Ruby sets out to solve, and succeeds.
Programming Ruby is organized into 3 main sections. The first
is a tutorial-style introduction to the language and its most
important features (132 pages). The second section describes
practical applications of Ruby to common programming tasks, like
GUI development, CGI programming, and extending Ruby using modules
written in C (64 pages). The final section provides a reference to
the syntax and features of the language, and a
full description of the standard library (316 pages). The appendixes
cover embedding documentation in source code, using Ruby from
the command-line, and where to look for support.
The first section will be the most important aspect for many prospective
buyers. It introduces the reader to the most commonly used
aspects of the language, demonstrating each concept with one
or several examples. I found this section to be fairly fast
paced, but I could keep pace with it comfortably. My background
is in Perl, Java, and Python, so I was already familiar with
many of the concepts being described: I was just looking for how
they were implemented in Ruby. This book does this very well.
However: if you have never programmed before, this is not
the book for you. If you're unsure what an object is, or how
an 'if' loop works, you will have a difficult time learning
those concepts from this book. I liked this section: after
reading it and skimming the second section, I was able to
begin writing porting some existing Perl code of mine to Ruby. Some tutorials are too slow-paced, and leave me frustrated while I wait for the author to describe the interesting features of the language: Programming Ruby does not do this.
The second section describes some practical applications of
Ruby. I thought this section was a bit disappointing. It is
short: most chapters are ~5 pages long, and the chapter on
'Ruby and Microsoft Windows' is only 2 pages! There is much more that
can be written on these topics, and it surprised me that the
authors only chose to include the most basic coverage.
Also, the tools used by the authors are also fairly primitive: for
web development, CGI is used; not mod_ruby or one of the
methods of embedding Ruby in HTML. For GUI programming,
Ruby/Tk is used, not Ruby/GTK.
The final section will provide a very valuable resource if you
decide to program in Ruby. It covers Ruby's syntax in detail,
filling in those topics that were skipped in the first section.
It describes Ruby's implementation of objects, including
reflection and dynamic method calls, as well as techniques
for sand-boxing Ruby code. There is a very interesting discussion
of serialization in Ruby (called "marshaling"), and distributed
Ruby. Again, more depth here would have been nice, but the
coverage that is provided is probably sufficient. The lengthiest part
of this section is the reference to the Ruby standard library.
If you use Ruby frequently, this section will soon be worth its
weight in gold. Personally, I would have preferred this section
to be sorted alphabetically, but that is a minor quibble.
The authors have published this section
they have also released this content under an "Open Publication"
license, allowing others to use it freely.
Programming Ruby provides a good summary of the Ruby language.
It is ideal for a programmer who already has experience with
a similar programming language, like Perl or Python, and is looking
to try something new. If you do decide to program in Ruby, the
content of the third section will be essential, and is easily
worth the price of the book. The disappointment with Programming
Ruby is the weakness of the second section; nevertheless,
I would recommend this book if you're interested in learning Ruby.