615-852-6559 615-852-6559

Blog

Book review: Refactoring Ruby Edition

13 March 2010

Refactoring is re-writing computer code so that it does the exact same thing (externally) but internally  is improved. By analogy, if you simplified your shopping list so that you were getting the exact same items, but in 3 stops instead of 5--you "refactored" it.  Same results; better methods. Refactoring is what you do with your code that works, so that it becomes shorter, more elegant, and useful for the next task.

What is this book?

It's a classic of programming, Refactoring, written 10 years ago by Martin Fowler but adapted for the Ruby programming language.

What I loved about it

Half theory

The theory section explains what is refactoring, when to do it, why do it. Here's an example on when to refactor:

Here’s a guideline Don Roberts gave me: The first time you do something, you just do it. The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway. The third time you do something similar, you refactor.

Half examples

Half the book is 80? step-by-step examples of refactoring situations with names like "replace object with hash" and "push down method". It's like a sharp sword to be wielded in doing battle with complex software projects.

Reading good code

Reading a book with great code all over the place makes me a better programmer.

Conclusion

It's a great book; on a short list of Best Ruby Books.


blog comments powered by Disqus