Advanced Search
Start Your Free Trial

Overview

Other Readers Also Read...
Refactoring: Ruby Edition

Refactoring: Ruby Edition
by Jay Fields; Shane Harvie; Martin Fowler

Top Sellers in this Category

How do you write truly elegant code with Ruby? Ruby Best Practices is for programmers who want to use Ruby as experienced Rubyists do. Written by the developer of the Ruby project Prawn, this concise book explains how to design beautiful APIs and domain-specific languages with Ruby, as well as how to work with functional programming ideas and techniques that can simplify your code and make you more productive. You'll learn how to write code that's readable, expressive, and much more. Ruby Best Practices will help you:

  • Understand the secret powers unlocked by Ruby's code blocks

  • Learn how to bend Ruby code without breaking it, such as mixing in modules on the fly

  • Discover the ins and outs of testing and debugging, and how to design for testability

  • Learn to write faster code by keeping things simple

  • Develop strategies for text processing and file management, including regular expressions

  • Understand how and why things can go wrong

  • Reduce cultural barriers by leveraging Ruby's multilingual capabilities

This book also offers you comprehensive chapters on driving code through tests, designing APIs, and project maintenance. Learn how to make the most of this rich, beautiful language with Ruby Best Practices.

Amazon.com® Reader Reviews (Ranked by Helpfulness)

Average Amazon.com® Rating: 4.5 out of 5 rating Based on 6 Ratings

Excellent. - 2009-07-06
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
One of my favorite simple pleasures is reading a technical or instructional book where the level of complexity perfectly matches my expertise. I've been enjoying this exact experience while reading Greg Brown's new book, Ruby Best Practices.

I have been programming professionally for over three years, with the last five months doing full time Ruby on Rails development. I would label myself an intermediate Ruby user: comfortable with the basics, but with limited exposure to its more advanced topics. Lately, I have been reading more and more open source Ruby projects, and have been looking for ways to contribute back to our teriffic community.

Given my experience and goals, Ruby Best Practices was a perfect read. The book is a collection of general strategies for solving problems in Ruby, with a focus on real-world code examples. Its author is an experienced Ruby developer who also happens to be an excellent writer.

Ruby Best Practices has a number of notable strengths. First, Brown is highly pragmatic. When discussing closures, he writes "I could show some abstract examples or academically exciting functionality such as Proc#curry, but instead, I decided that I wanted to show you something I use fairly frequently." This attitude has lead to a book that is full of ideas you can actually use. It feels like the experienced guy down the hall showing you all his best stuff.

Secondly, RBP's examples are almost uniformly excellent. As contributor or creator of several popular Ruby projects (Prawn and Ruport) Brown has no lack of real-word code examples to choose from, and he does so with skill. In addition, he's not shy about trimming down the examples to leave behind just the most relevant code elements. These two factors combine to produce code listings which are indicative of real open-source programs while remaining quite comprehensible. Not only are Brown's examples excellent, but they are plentiful. Nearly every new idea he introduces is demonstrated through a case study of real (or plausibly real) code. Working through this book will definitely sharpen your code-reading skills.

Beyond simply being clear, Brown's writing is also fun to read. His enthusiasm for the subject matter is obvious: "I could stop here and move on to the next topic, but similar to when we looked into the belly of lazy.rb earlier in this chapter, I can't resist walking through and explaining some cool code." This sort enthusiasm continues throughout, and leads to a technical book that I'm tempted to call a page-turner. Making my way through the book really excited me to read and work on open-source projects.

If you're still on the fence, take a read through the sample chapter, Mastering the Dynamic Toolkit (available through O'Reilly or the book's blog). If you like what you see, don't hesitate to pick up a copy of this excellent book.

Below average - 2009-09-23
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
Most of the concepts are already covered by other Ruby books. I did learn a few things from this book. The examples in this book have too much baggage. The focus should have been in illustrating the best practice instead of obsessing about code from real projects. Ideally illustration with simple examples that introduces the concept followed by real world code example would have better for the readers.

The author's opinion about functional programming is not correct. For instance higher-order procedures in Ruby are useful in real projects for certain problems. I am surprised by the poor technical review / edit by a publisher like OReilly and the author is not to be blamed for technical correctness. The rating takes a hit due to this because the product is a reflection of the work of the publisher and the author.

The author states "However, judging when it's the right time to bust out some functional goodness rather than going with the more vanilla approach can be difficult, even among seasoned developers. It is entirely possible to make your code too clever, and this often has real penalties in performance or in the ability of other developers to easily learn your code."

There are certain guidelines that can be used to decide whether functional programming techniques is a better fit to solve the problem at hand. Unfortunately it is not covered in this book. Just search for higher order procedures in Ruby and read the presentation / blog by Nate Murray. He has taken the higher order procedure examples based on Lisp and converted them to Ruby. At the end of his presentation you will see some practical examples related to this topic.

Intermediate-to-expert Ruby programmers should absolutely read this book - 2009-08-03
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
In Summary:

If you are an intermediate-to-expert Ruby programmer you should absolutely read this book. Beginners may want to start elsewhere and work their way up. Where To Get It

In Detail:

The purpose of RBP is stated plainly on the front cover: "Increase Your Productivity -- Write Better Code"

With that in mind, here is a breakdown of what it offers:

The first thing I noticed when reading RBP is that it uses real-world code samples. None of that "let's make a tic-tac-toe game" type of stuff. Gregory uses a couple of his own projects (Prawn & Ruport) as well as other popular libraries (Haml, flexmock, XML Builder, Gibberish, faker). This is beyond awesome.

He also steps through a lot of code using IRB, which means you can follow right along in your favorite shell. Gregory highly recommends you get your hands dirty with the code he presents and I agree with him. However, I also like to read physical books in places not my computer, since the opportunity so rarely presents itself.

The book starts, aptly, with a chapter on testing. The following two chapters are (for me) the highlights:

Designing Beautiful APIs and Mastering the Dynamic Toolkit.

The value found in these two sections alone cover the cost of the entire book. A few of the topics discussed include: flexible argument handling, code blocks, implementing per-object behavior, building classes and modules programatically and registering hooks and callbacks. Gregory released a free section of Mastering the Dynamic Toolkit so you don't have to take my word for it, have a taste for yourself.

I need to wrap this up or I'll be forced to remove the "Mini" from the post title. You'll also find sections on File & Text processing, functional programming, debugging, project maintenance (much of which is obsolete if you use the wonderful Jeweler gem), and internationalization.

Tips, tricks and suggestions abound. Even expert-level Rubyists should learn something. RBP left me wanting more of Gregory's teaching. He really does a good job of explaining concepts and walking through code. Thankfully, he started up a Ruby Best Practices blog with more content!

A Must-Have for the Serious Rubyist - 2009-09-25
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
If you're coming here to expect a cookbook you needn't bother. What you'll find instead, is a thoughtful guide to the gestalt of Ruby development. This book digs deeper than a book like "The Ruby Cookbook" because it gets to the underlying principles that guide good Rubyists. This book fills a big void in the are of Ruby books. Other books will tell you how to get something done, this one will explain why to do it a certain way.

No fluff, solid-to-the-core, key information for Ruby programmers - 2009-09-24
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I'm greatly impressed by this book. I've looked through perhaps two-dozen Ruby books, and with few exceptions they trot out clumsy, contrived examples that not only do a poor job of explaining syntax, but fail to demonstrate better Ruby practices.

Ruby Best Practices excels where these other books fail. It uses honest-to-gosh, real-world code, and thoughtfully explains the reasoning for coding a solution in a particular way.

It explains the choices one may have to make, the possible trade-offs, and leaves you with enough information to start applying these ideas to your own code.

No style of presentation will please everyone, and if you are looking for terse, superficial examples that do not fully demonstrate the real-world how's and why's of a particular approach you will be disappointed. This book requires that you read along, and *think* along, as code is presented and solutions reasoned out. You will, however, be a better Ruby hacker as a result of it.

Browse Similar Topics

Top Level Categories:
Internet/Online
Programming

Sub-Categories:
Internet/Online > Web Development
Programming > Ruby

Some information on this page was provided using data from Amazon.com®. View at Amazon >


About Safari Books Online • Terms of Service • Privacy Policy • Contact Us • Corporate Licenses • Help • Accessibility | See us on FacebookSee us on Linked InSee us on TwitterRSS

Copyright 2009 Safari Books Online. All rights reserved.