1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Refactoring in Ruby

About.com Rating 4.5 Star Rating

By

Refactoring in Ruby

The Bottom Line

Refactoring in Ruby by William C. Wake and Kevin Rutherford is a hands on workbook that teaches refactoring in Ruby. It is an update of an earlier work from William C. Wake, which taught the same subject in Java. It's a solid work on refactoring and an excellent hands on introduction.

If there's one thing that sets Refactoring in Ruby out from the competition, it's that this is a workbook. The examples aren't just for reading and analyzing. You're expected to work with the example programs and perform your own refactorings, instead of just skipping to the solution and seeing how the authors refactored it.

Pros

  • Created from an established work on the subject.
  • Hands on.
  • Extensive catalog of "code smells."
  • Easier to understand than Refactoring: Ruby Edition.

Cons

  • Not an extensive reference.
  • Not as useful for those who can practice on their own code.

Description

  • A practical introduction to refactoring by example.
  • A catalog of "code smells," the meat of the book.
  • Each "code smell" chapter has a number of small programs to refactor.
  • "A Simple Game" program to refactor.
  • "Time Recording" program to refactor.
  • "Calculator" program to refactor.
  • Answers to all exercises in the back of the book.

Guide Review - Refactoring in Ruby

Refactoring in Ruby takes a different approach to the topic of refactoring than another title recently reviewed here, Refactoring: Ruby Edition. Where Refactoring: Ruby Edition takes a very practical approach to cataloging useful refactorings, Refactoring in Ruby trains you to spot "code smell" and gives you a general direction to how you might fix it. It also stresses practice with the example programs, and gives some larger scale programs in the back of the book to try your new skills on.

Refactoring in Ruby is split into four sections. The first section gives an introduction to the concept of refactoring. It also gives some general advice on how to implement refactorings and how to integrate them into your tests.

The section section of Refactoring in Ruby is the main attraction. This section is a catalog of "code smells," or clues that something could be done better. Each smell is presented in several sections: What to Look For, Why This is a Problem, When to Leave It, How It Got This Way, What To Do and What to Look for Next. At the end of each chapter in this section, there are hands on exercises.

The third section presents three longer programs for you to practice your refactoring skills. These are programs you may want to continually be working on while working your way through the code smells section, fixing smells as you learn them.

The fourth section presents answers to the exercises throughout the book. By putting them at the end of the book, it's more difficult to "cheat" and skips ahead to them without working through them first.

In all, this is a very solid book. While not as comprehensive as Refactoring: Ruby Edition, it is more hands on. This book is of interest not only to those wanting to learn how to refactor, but can even teach those already refactoring a trick or two.

  1. About.com
  2. Technology
  3. Ruby
  4. Reviews
  5. Book Reviews
  6. Guide Review: Refactoring in Ruby

©2014 About.com. All rights reserved.