Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×
Image

Ruby In Practice 104

Posted by samzenpus
from the read-all-about-it dept.
littleidea writes "Ruby In Practice is like a sampler platter that picks up where The Ruby Way leaves off. Depending on your tastes each of the different offerings are delicious, but sometimes leave you wishing you had a whole order of just that. Then again, if you eat the whole thing, chances are you won't be hungry." Keep reading for the rest of Andrew's review.
Ruby In Practice
author Jeremy McAnally, Assaf Arkin with Yehuda Katz, David Black, Gregory Brown, Peter Cooper and Luke Melia
pages 335
publisher Manning
rating 8
reviewer Andrew Clay Shafer
ISBN 1933988479
summary A cookbook style reference with Ruby code examples for systems integration, monitoring, messaging, web development, processing documents and databases in a clear problem/solution format.
I really jumped headfirst into Ruby and the Ruby ecosystem when I started working on Puppet around Fall 2007. I had spent years writing code in compiled imperative and object oriented languages and just dabbled with interpreted languages before that. I've met Jeremy and several of the authors of Ruby In Practice at Ruby conferences since then.

I had a particularly hard time rating this book. If you have just learned the Ruby basics and you need to hook up your jabber server to a message queue that will spawn workers that interact with RESTful web services exposing indexed logs to twitter by tomorrow, then this book is a 10. If you are a hard core Rubyist plugged into the Ruby ecosystem, and 'Ruby In Practice' is what you do all the time, then this book is probably a 6, useful and enjoyable but hard to recommend. I'm somewhere in the middle, so I'm giving the book an 8.

The books starts out with the premise that the reader can read Ruby code. I wouldn't call the style 'code heavy' but this book is definitely 'code ample'. If you haven't been through the Pickaxe or at least a Ruby primer of some sort, be prepared to spend some time head scratching and googling before all the code syntax makes sense. That being said, you don't need to understand the subtleties of 'yield' or 'inject' to understand the examples and the book does a reasonably good job of walking through and explaining them. The exceptions to that are some of the examples involving Rails make the assumption that the reader is familiar with those idioms, which is probably fair statistically speaking and those bits can be filled in rather quickly with one of the many books on the topic or your search engine of choice.

The book credits a number of Rubyists with contributions for each of the sections. This makes for some noticeable variation in the stylistic presentation from topic to topic. As I alluded to earlier, each of the sections is more of a taste of a topic than a full exploration, but there are also references to the resources one would need to pursue each topic more fully.

The book starts out with chapter on 'Why Ruby' followed by an attempt to convert readers to become 'Test Infected', then the real Ruby fun begins in chapter 3. The first example is scaling images, stuffing them in Amazon S3 and printing the link to Twitter in 30 something lines of code. If you don't understand Ruby syntax and passing blocks, you will probably be a little lost here, but the good news is: if you take the time to sort out these first examples the rest of the code in the book should be relatively accessible. The application domain will vary throughout the book, but the level required to understand the ideas expressed in the code remains relatively constant. (which one might argue is one of the strengths of Ruby as well)

By this point, the rest of the book basically follows this pattern, discussion on a technology topic, gem install, code examples, links to more resources. I'm not going to list all the topics, though I alluded to many of them when I discussed the rating. (Here's the TOC to give you some idea.) The book definitely covers ground.

There is some really choice stuff in there and I definitely learned things, but there are a few things that are presented through Ruby colored glasses (as one would probably expect). The one that will always stick out is 'Say goodbye to dependency hell!' in reference to setting up a gem repository and using RubyGems (gems is Ruby's network library/package manager, similar to CPAN for perl or apt for Debian Linux) . I had a little chuckle and eye roll at that one. (Sorry Jeremy)

One quick note, and this is a comment about the Ruby ecosystem as much as anything, Ruby libraries change relatively quickly. On the one hand, gems are mostly up to date and tracking new versions of whatever they integrate with, on the other, this can sometimes break backwards compatibility. I didn't run every line of code in the book, but I played around with a good portion of it. There were a few gem updates which were not compatible with the code in the book. The twitter gem in particular had non-backward compatible changes to authentication (to support OAuth). I was able to get the example working with a few minutes of Google and looking at the code, but that might have taken longer and been frustrating if I didn't have a Ruby background. Ruby In Practice provides enough context and information that you can probably find the maintainer or community for a project without much trouble if you really get stuck.

I would strongly recommend this book to someone who has come to Ruby through Rails and is ready to learn more about what is possible with the language or someone who is coming from another language background with experience and perspective on things like stomp servers or Lucene and who's interest in dynamic languages has been piqued (if you have a background in any OO language, a simple primer is probably enough to make this book accessible. Also, you should remember irb, the interactive ruby interpreter, is your friend.) Anyone in either of those groups will get working examples and resources that could realistically be used in useful applications right away.

You can purchase Ruby In Practice from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

*

This discussion has been archived. No new comments can be posted.

Ruby In Practice

Comments Filter:

When the weight of the paperwork equals the weight of the plane, the plane will fly. -- Donald Douglas

Working...