Chapter 2. Principles in Refactoring

The example in Chapter 1, “Refactoring, a First Example,” should give you a good feel for what refactoring is all about. Now it’s time to step back and look at the key principles of refactoring and at some of the issues you need to think about in using refactoring.

Where Did Refactoring Come From?

I’ve not succeeded in pinning down the real birth of the term refactoring. Good programmers certainly have spent at least some time cleaning up their code. They do this because they have learned that clean code is easier to change than complex and messy code, and good programmers know that they rarely write clean code the first time around.

Refactoring goes beyond this. In this book I’m advocating refactoring as ...

Get Refactoring: Ruby Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.