Book Review: The Ruby Way, Second Edition

8 commentsWritten on August 31st, 2010 by
Categories: Books

The second book i read in my ongoing Ruby journey is the second edition of The Ruby Way. While i don't think it's as essential as The Ruby Programming Language (you can read my review of it here), it is a very useful resource to the beginning Ruby programmer. As good as it is, it certainly has a lot of flaws as well.

At over 800 pages, this book is obviously big and heavy. That in itself is not necessarily a problem, but i wasn't happy with the actual binding of the pages. Flipping through them just doesn't feel right and i often felt that i had to be somewhat careful with a page if i didn't want it to be torn out of the book by accident. And it really wouldn't take that much effort for that to happen. If there is one book that's an ideal test case to make you seriously consider switching to an iPad/Kindle for your reading, then this is probably it.

Luckily, the content of the book does make up for the shoddy physical reading experience. This book covers a lot of topics, which is not only a great way to introduce the beginning Ruby programmer to a variety of possibilities, but also a welcome reference to keep on your desk if you quickly need to look up how to do something. It starts off with a short review of the Ruby language, and then works its way through a variety of topics, most of which are covered very thoroughly. You really will learn everything there is to know about strings, regular expressions, numeric types, symbols, ranges, dates and times and enumerable types (arrays, hashes, sets, ...). At this point, you're about 320 pages into the book with another 450 or so to go. Those first 9 chapters are probably also the only part of the book that will at one point be read by everyone who bought this book, either while reading cover-to-cover or when you're looking for something specific later on.

The next topic that is covered is that of IO and Data Storage. Again, this is covered pretty extensively because you'll learn all about typical file management operations, as well as how to do marshaling of objects. There's also a brief part on dealing with databases but it's so short that it really would've been better left out altogether. You'll see how to connect and interact with a few of the well known databases in a pretty low-level manner, but really though, hardly anyone still deals with databases in that way. It probably would've been better to point to some higher-level data access frameworks, since the people who are going to deal with a database in such a low-level manner are probably more than capable of figuring out how to do so without referring to a book that only briefly lists a few things that you can do for basic stuff, but nothing important.

The next chapter covers Ruby's OOP and Dynamic features/capabilities and it's a good 80 pages long. It goes through some of the topics a bit too quickly for my taste, but that's alright since the next book on my reading list is Metaprogramming Ruby which is sure to whet my appetite for dynamic goodness. It does again cover quite a lot, but if you've read The Ruby Programming Language already, you won't really find anything new here.

Next up is an overview of some of the graphical toolkits that you can use with Ruby. This is a chapter that ultimately doesn't bring any value since coverage of a single toolkit is probably enough to fill an entire book already. The examples shown for each of the toolkits in this chapter are obviously short and offer no more than a quick look at how you'd interact with a certain toolkit. Well, in my case it inspired me to come up with a decent event syntax for Ruby, but that's about it. It probably would've been better to leave this chapter out, and just refer to these toolkits in an appendix or something.

The book then switches to a topic that i'd been looking forward to: Threading. While Ruby does offer some constructs to deal with threading, it's a far cry from what you might be used to in .NET. I was also surprised with the lack of attention paid to asynchronous operations, but then again, there just might not be that much interest in asynchronous programming in the Ruby world. This is definitely something i need to look into more as i continue on my Ruby journey :) . Another downside to this chapter is that some of the examples are a bit simplistic, and in some cases, aren't quite thread-safe. If you read this chapter, focus on the discussion of what you can do with Ruby from a threading point of view, but please don't reuse any of the code in your own code because you will end up chasing race conditions because of it.

The next 2 chapters deal with scripting, system administration and working with certain data formats (xml, rss, images, pdf). Depending on what you need or what you're working on, this could be pretty interesting to you. The book then switches to the topics of testing and debugging. This isn't really covered in-depth and as such, this too would've been better suited for an appendix with some links to online resources or dedicated books on these subjects. After that it gives another quick overview of packaging and distributing your code. This chapter also would've been better off being dropped since i had to package and distribute some Ruby code today and i found more useful and relevant information online than i did here.

The book then starts focusing on writing code again, but this time in the online world. First you'll learn about low-level network programming in a chapter that is dedicated to the topic. After that, there's a chapter about Ruby and webdevelopment and it kinda suffers from the same problems as the GUI toolkits chapter did. It lists a few of the options, of which at this point only Rails still seems to be popular but it can't really tell you anything in-depth about it. Once again, a summarized version of this chapter would've been better fit for an appendix. Finally, you'll learn about Distributed Ruby which is illustrated with an example.

The book then closes with 2 more chapters, one covering some Ruby development tools, and finally, some words on the Ruby community.

This is by far the longest book review i've ever written, but then again, this book is huge and i did have a lot to say about it. Its biggest flaw (apart from the shoddy physical reading experience) is that it tries to cover too much, and because of that, a lot of the stuff that is covered is basically pointless. Ideally, this book would've been limited to the first 11 chapters, followed by the chapters on threading and networking. The stuff about databases, web frameworks, GUI toolkits, etc... should've been covered in succinct appendices which should just point the reader in the right direction since there's no way one single book can cover all of it anyway.

I know this review might come over as hard on the author and the content, but i really did like half of the book a lot. The other half however prevents me from starting this post with 'Recommended Book' or 'Highly Recommended Book' instead of 'Book Review'. Hopefully, the upcoming 3rd edition (which should be out sometime next year) fixes some of these flaws so this book can reach the potential that it certainly does have. In the meantime, i will keep this book on my desk as a reference. About 500 of these 800 pages do contain a lot of great stuff that's gonna save me a lot of time after all.

  • http://www.jacopretorius.net Jaco Pretorius

    Nice review – you have an awful lot of patience! I don’t think I would have finished a book that had all the flaws you mentioned… But very nice review, very useful.

  • http://davybrion.com Davy Brion

    @Jaco

    it would’ve been different if the first part of the book wasn’t as good as it is… i really think that this book could be absolutely fantastic, but the second half of the book just needs a lot of cutting for that to happen.

  • http://annalear.ca Anna Lear

    I haven’t even tried to read it cover to cover. I use this book more as a “how to” reference for specific tasks, especially when my brain is firmly stuck in C# mode and I just can’t break free. :)

  • http://davybrion.com Davy Brion

    @Anna

    just wondering: in what ways is your mind still stuck in C# mode while you’re doing Ruby?

  • http://annalear.ca Anna Lear

    @Davy: It varies. Some days I just keep thinking like I’m still writing C# — I start trying to create properties, go for ‘for’ loops for everything, etc. Some days I just stare at the screen and go “Uh, I need current time. It’s not DateTime.Now. But what it is?!”

    Sort of like forgetting a verb mid-sentence when speaking a different language. I haven’t done much with Ruby yet, so I imagine it’ll be less of a problem as I become more familiar with it.

  • http://davybrion.com Davy Brion

    @Anna

    i’m experiencing the opposite… i do C# during the day, and it feels like i have to fit my newly-found ruby-way-of-thinking to C#, as far as that is possible

    hell, i’m even swearing because of the semi-colons lately

  • http://annalear.ca Anna Lear

    I should spend more quality time with Ruby and see if/when perspective changes.

  • http://www.jacopretorius.net Jaco Pretorius

    Haha – I see your point with the semi-colons. At first I kept wanting to put semi-colons in my Ruby code, now I get annoyed with having to put them in C#!