Ruby Best Practices

Added by Dmytro Shteflyuk on , authored by Gregory Brown

Ruby Best Practices
Started reading:
22nd November 2009
Finished reading:
29th November 2009

Order on Amazon.com

Book rating: 7 of 10

Review

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.

Do not expect too much from this book. Please do not get me wrong, this is a good book and it deserves being read by any Ruby developer, but it does not teach you how to write perfect code. There are many techniques covered in various topics: API design, dynamic programming features, standard libraries, multilingualization, documentation and many more. Some of them are incredibly useful and could improve your code significantly, other are interesting, but you will never use them in your real code. The best thing about this book is that it shows you really good code, it gives you feeling of beauty.

Did it influence my code? Definitely. First thing I did while reading was blocks support in Sphinx#query for more natural search.

Will I recommend this book to my friends? Probably. If you would like to feel code smell better — read it. If you want this book to open your eyes and teach you the Ruby-fu — you should probably find another one.