Start reading Ruby Best Practices on the free Kindle Reading App or on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here.
Programming Books C Java PHP Python Learn more Browse Programming Books

Deliver to your Kindle or other device

Enter a promotion code
or gift card

Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Sorry, this item is not available in
Image not available for
Image not available

To view this video download Flash Player


Ruby Best Practices [Kindle Edition]

Gregory T. Brown
4.3 out of 5 stars  See all reviews (14 customer reviews)

Digital List Price: $27.99 What's this?
Print List Price: $34.99
Kindle Price: $15.39
You Save: $19.60 (56%)

Free Kindle Reading App Anybody can read Kindle books—even without a Kindle device—with the FREE Kindle app for smartphones, tablets and computers.

To get the free app, enter your email address or mobile phone number.


Amazon Price New from Used from
Kindle Edition $15.39  
Paperback $25.82  
Shop the new
New! Introducing the, a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now

Book Description

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.

Editorial Reviews

Book Description

Increase Your Productivity - Write Better Code

About the Author

Gregory T. Brown is a New Haven, CT based Rubyist who spends most of his time on free software projects in Ruby. His main projects are Prawn and Ruport, and he is also the author of the upcoming book Ruby Best Practices. He also is in possession of a small bamboo plant that seems to be invincible, and he is quite proud of this accomplishment.

Product Details

  • File Size: 845 KB
  • Print Length: 336 pages
  • Simultaneous Device Usage: Unlimited
  • Publisher: O'Reilly Media; 1 edition (June 11, 2009)
  • Sold by: Amazon Digital Services, Inc.
  • Language: English
  • ASIN: B002L4EXFQ
  • Text-to-Speech: Enabled
  • X-Ray:
  • Word Wise: Not Enabled
  • Lending: Not Enabled
  • Amazon Best Sellers Rank: #538,720 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  •  Would you like to give feedback on images?

Customer Reviews

Most Helpful Customer Reviews
22 of 22 people found the following review helpful
5.0 out of 5 stars Excellent. July 6, 2009
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.
Read more ›
Comment | 
Was this review helpful to you?
14 of 15 people found the following review helpful
5.0 out of 5 stars Very Unique Ruby Book. A Challenging Teaching Tool. June 25, 2009
Format:Paperback|Verified Purchase
Ruby Best Practices (RBP) by Gregory Brown is unlike any previous book on Ruby written yet. This is not a book of commandments, recipes, design patterns, or style guides. Rather this is a book that is designed to help intermediate Ruby programmers learn how to think about writing and analyzing software.

If RBP had a biggest strength it would be its case-study approach of looking at real-world Ruby software as the context for best practices. It is not a theoretical or hypothetical book but very practical. One of the premises of RBP is that best practices have a context--a time and place--and aren't just rules we slap across everything indiscriminately. It is meant to spur dialogue and provoke thought. It will help give you a new set of eyes as you read through Ruby source code (which brings up another premise of RBP--you should be learning by looking through the source code of real projects).

If RBP had a biggest weakness, it would be that it was written by one guy with help from a few others and it is limited to their observations and experience. Not everything is covered nor can it be. Somebody will complain that it is not complete but Gregory has sort of preserved himself from that sort of fault-finding by presenting this more as a "one side of the diamond" than a "here are the best practices, follow them" approach.

I think that RBP is important for the Ruby community not because it contains the solutions to everyone's problems but more because it can serve as a great launching point for important discussions that will help us to think through the Ruby software we write and how to glean from the outstanding solutions other Rubyists smarter than ourselves have come up with.

I like the way this book is organized for the most part.
Read more ›
Comment | 
Was this review helpful to you?
8 of 8 people found the following review helpful
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.
Read more ›
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
3.0 out of 5 stars Nice book
The book is good. It showed me couple of techniques. Author promised to write one more version, it sounds exiting to me! Thanks Gregory T. Brown for writing this. Read more
Published on January 11, 2012 by Bogdan Kulbida
4.0 out of 5 stars An Excellent Book for the Rubyist's Bookshelf
This book is easy to read and follow. The author's approach both witty and easy to follow. His presentation is a perfect balance of not being too technical but technical enough to... Read more
Published on November 27, 2010 by NicholasC
3.0 out of 5 stars Groan - Good content; but hard to read!
Even though the author knows what he's talking about, he takes quite a while (in each and every case) to get to the point. Read more
Published on June 28, 2010 by Harold Campbell
5.0 out of 5 stars Awesome book for intermediate Rubyists
I thoroughly enjoyed this book. As an experienced programmer and intermediate level Rubyist (doing Ruby for about a year) most other books are too basic. Read more
Published on June 1, 2010 by T. Huss
3.0 out of 5 stars Ok only
3 stars - the book as it stands
5 stars - the book how it WILL be

David Flanagan and Yukihiro Matsumoto's book "The Ruby Programming Language" was much more useful... Read more
Published on April 4, 2010 by AmazonH
5.0 out of 5 stars Rubyists that want to learn how to write code like the experts should...
After learning the basics of Ruby and feeling at ease with the language, it's time to take it to the next level. It's time to start writing code like the experts: the Ruby way. Read more
Published on March 12, 2010 by Raoul Felix
5.0 out of 5 stars Great Read
I've been developing in Ruby and in Rails for several years, but have not taken the time to make sure that my coding standards and techniques are in line with other Ruby... Read more
Published on March 3, 2010 by J. Fister
5.0 out of 5 stars Excellent Intermediate Ruby Book
As I was managing a Python to Ruby conversion, Ruby Best Practices was just about the best book I picked up to get over the initial hurdle. Read more
Published on February 5, 2010 by Devin J. Naquin
5.0 out of 5 stars A Must-Have for the Serious Rubyist
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. Read more
Published on September 25, 2009 by Alex Vollmer
5.0 out of 5 stars No fluff, solid-to-the-core, key information for Ruby programmers
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... Read more
Published on September 24, 2009 by James Britt
Search Customer Reviews
Search these reviews only

More About the Author

Discover books, learn about writers, read author blogs, and more.


There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
First post:
Prompts for sign-in

Look for Similar Items by Category