Kuro5hin.org: technology and culture, from the trenches
create account | help/FAQ | contact | links | search | IRC | site news
[ Everything | Diaries | Technology | Science | Culture | Politics | Media | News | Internet | Op-Ed | Fiction | Meta | MLP ]
We need your support: buy an ad | premium membership

[P]
Review of 'Programming Ruby'

By klamath in Technology
Wed Feb 14, 2001 at 09:37:37 AM EST
Tags: Books (all tags)
Books

Programming Ruby: The Pragmatic Programmers Guide (Addison-Wesley, 2000) by David Thomas and Andrew Hunt is a new book on the Ruby programming language.


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 online; 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.

Rating: 9/10

Sponsors

Voxel dot net
o Managed Hosting
o VoxCAST Content Delivery
o Raw Infrastructure

Login

Poll
Are you interested in learning Ruby?
o Yes 52%
o No 47%

Votes: 59
Results | Other Polls

Related Links
o Programming Ruby: The Pragmatic Programmers Guide
o Ruby
o The Pragmatic Programmer
o mod_ruby
o Ruby/GTK
o online
o released this content
o Also by klamath


Display: Sort:
Review of 'Programming Ruby' | 24 comments (11 topical, 13 editorial, 0 hidden)
I would like to know more about this language (none / 0) (#12)
by Simon Kinahan on Wed Feb 14, 2001 at 09:39:03 AM EST

I'm a bit of a language nut. I would like to know more about this one. I voted this up because its a good book review, but does anyone have a pointer to an overview of the language features ?

Simon

If you disagree, post, don't moderate
Pointer is in the header of this article... (none / 0) (#13)
by Mashx on Wed Feb 14, 2001 at 09:55:59 AM EST

Link to Overview of Ruby here: http://www.ruby-lang.org/en/whats.html
Woodside!
[ Parent ]
Thanks (none / 0) (#14)
by Simon Kinahan on Wed Feb 14, 2001 at 09:57:55 AM EST

Actually, I just found www.rubycentral.org, which is very informative. As a whole the language looks very like Smalltalk with some Perl-like elements.

Simon

If you disagree, post, don't moderate
[ Parent ]
more Ruby links (none / 0) (#20)
by KernelPanic on Thu Feb 15, 2001 at 02:13:12 AM EST

http://www.rubycentral.com
The article in the Jan 2001 issue of Dr. Dobb's Journal is quite good as well: http://www.ddj.com/articles/2001/0101/0101b/0101b.htm

[ Parent ]
Could someone compare Ruby and Smalltalk (none / 0) (#16)
by SIGFPE on Wed Feb 14, 2001 at 12:35:04 PM EST

A year or two ago I looked into Ruby and it looked remarkably like Smalltalk with slightly modified syntax. I'd be interested to know in what ways this impression is incorrect.
SIGFPE
comparison (none / 0) (#18)
by klamath on Wed Feb 14, 2001 at 10:03:43 PM EST

There's a comparison here. I haven't looked at it though, so I can't vouch for its quality.

[ Parent ]
You're correct. (none / 0) (#21)
by BJH on Sun Feb 18, 2001 at 11:25:20 AM EST

The author of Ruby has stated that, as Larry Wall came to create Perl from awk, C, etc., he came to Ruby from Smalltalk. It's a deliberate attempt to include the "good" parts of Smalltalk in a (semi-)Perl-like scripting language.
--
Roses are red, violets are blue.
I'm schizophrenic, and so am I.
-- Oscar Levant

[ Parent ]
good book, great language! (4.00 / 1) (#19)
by KernelPanic on Thu Feb 15, 2001 at 01:56:23 AM EST

I've had the "Programming Ruby" book for over a month now. I agree with this review. This book tries to give a broad overview of the language and also serves a s reference. Hopefully other more in-depth books will follow: "Distributed Ruby Programming", "Advanced Ruby Programming" - you get the picture. But this is a good first book for the language. And I must say that coming from programming in Perl for the last five+ years, I really like the Ruby language. Object Oriented programming in Perl has a kludgy feel to it. Last summer I checked out Python, but decided that it just wasn't compelling enough to make the switch. Now that I've discovered Ruby, however, I do plan to begin to implement upcoming projects in Ruby. Also, distributed programming with Ruby (using dRuby) is quite possible and elegant - I already have prototyped a distributed system at work with it and it was done in a surprisingly short amount of time given that I'm a newbie to the language.

book now available online (none / 0) (#22)
by nickp on Wed Feb 21, 2001 at 04:34:50 PM EST

Just got this news over ruby mailing list today: the book is now available online.

"Gravitation cannot be held responsible for people falling in love." -- Albert Einstein

Interesting... (5.00 / 1) (#23)
by scriptkiddie on Fri Mar 09, 2001 at 01:34:03 AM EST

I heard about Ruby a few years ago, but back then there was no English documentation. I just read their tutorial, and it seems like a neat language.

Ruby fixes some annoyances in Python - it's pure object-oriented, which makes a lot of sense. But it just doesn't "feel" like a very clean language design to me. Many languages are far worse, of course, but if you want to make a fresh start, it seems like one could do it better.

The whole thing with accessors and mixins seems like an ugly compromise. Modules, as they are implemented, seem unnecessary. I like the system of constants (something Python sort of lacks), but I don't see anything about C-like enumerators, which would be very useful in this kind of environment. And my biggest nitpick is that it's a one-pass interpreter, which both breaks otherwise-perfect code and potentially slows things down.

Oh yeah, there's one thing I'd really like to see in an interpreted language - explicit interfaces. An example of where this is sorely needed is Python's database interface. It's defined in a long, somewhat complex document that leaves a lot of room for ambiguity. Database module authors have interpreted the database API different ways, resulting in subtle differences between modules that are otherwise compatible. If they could just write, "class MySQLdb implements DBAPI:" and have the code automatically checked, this whole set of problems could be avoided.

Of course, the question arises, Who in an interpreted environment is supposed to check interface compliance? I think that a language like Python or Ruby could really use a "compiler" that would combine specified data files into a single package which could then be executed directly or installed into some kind of package database. Logically, then, interface compliance would be verified when things are packaged up. And you could do other neat things, like compile object files, extract inline documentation and sign source files at the same time.

Just a few ideas for when I get around to writing Dan++ 2000. :)

(sorry to ramble)

Ruby is worth a look (none / 0) (#24)
by gavinb on Mon Mar 12, 2001 at 06:11:07 PM EST

I read Dave & Andy's first book (The Pragmatic Programmer) last year, and I could not put it down. It was one of those books which resonates with you, and you find yourself either saying "Yes, I do that too", or "Wow, I really want to try that".

I had heard about Ruby on comp.lang.python and so when I saw the Pragmatic guys had written a book on it, I figured it was definitely worth buying.

I was not disappointed; the book is well-written and engaging, while giving lucid explanations of the language features. There are a few topics which could have done with a gentler treatment such as co-routines, which will probably be new to most programmers, but on the whole well-worth it.

I recommend interested parties (especially suffering Perl programmers) check out Ruby Central, and expand your horizons.


[ ::gavinb ][ "You can lead a moron to knowledge, but you can't make him think." ]

Review of 'Programming Ruby' | 24 comments (11 topical, 13 editorial, 0 hidden)
Display: Sort:

kuro5hin.org

[XML]
All trademarks and copyrights on this page are owned by their respective companies. The Rest 2000 - Present Kuro5hin.org Inc.
See our legalese page for copyright policies. Please also read our Privacy Policy.
Kuro5hin.org is powered by Free Software, including Apache, Perl, and Linux, The Scoop Engine that runs this site is freely available, under the terms of the GPL.
Need some help? Email help@kuro5hin.org.
My heart's the long stairs.

Powered by Scoop create account | help/FAQ | mission | links | search | IRC | YOU choose the stories!