
We earn a commission if you buy through these links. Learn more
Refactoring
Guide by the Books of the Day editors · Updated · How we write our guides
The book that taught a generation of programmers to change working code safely, using small, tested moves and a named catalog that turns tangled functions into clear ones.
What Creators Say About Refactoring
2 creators reviewed Refactoring on YouTube between 2019 and 2024, with 60.7K views between them. Their opinions are their own; we picked these reviews, we didn't write them.
What It's About
Refactoring is Martin Fowler's guide to improving the internal design of code that already works. Its central claim is that you can reshape a program in tiny, behavior-preserving steps, and that doing so continuously is how software stays easy to change. The book is best known for its catalog of named refactorings, such as extracting a function or moving a field to another class, each with a description of when it helps and a short set of mechanics for carrying it out safely.
The 2018 second edition, which Fowler wrote with JavaScript examples, keeps the core approach but updates the catalog and language for modern code. The running example is a small program for a video rental shop, which gets reworked step by step so you can see each change land. Expect the reading to feel practical and deliberate rather than dramatic: many pages are short, and the real value comes from following along with code and tests.
Reading it is less like absorbing a theory and more like watching an experienced developer narrate their habits. Fowler explains how to spot code that is starting to smell, why tests make the process safe, and how to decide when a change is worth making at all. The tone is patient and friendly, and the reasoning matters as much as the recipes.
Read this if you…
- you maintain a codebase you did not write and want a practical way to improve it without a rewrite
- you want a shared vocabulary of named code changes to use in code reviews and pair programming
- you already write object-oriented code and want to build better judgment about clean design
Skip it if you…
- you want a high-level book on software architecture or system design at scale
- you need a quick read, since the catalog is long and is better used as a reference than read cover to cover
Key Ideas
- 1
Refactoring means behavior-preserving change
The defining discipline is changing a program's internal structure while its observable behavior stays the same. Fowler treats this as separate from adding features, so you never mix the two in one step. That separation lets you move quickly without quietly breaking things, and it gives you a clear test for whether a change qualifies.
- 2
Tests are the safety net for every move
Small changes only feel safe when a reliable suite of tests can confirm nothing broke. The book assumes you have tests, or will write them, before restructuring anything. It treats them as the thing that makes rapid, incremental change practical. Without them, the same moves become risky guesses.
- 3
A named catalog of common moves
Each refactoring in the catalog gets a name, a motivation, and step-by-step mechanics. Names give teams a shared vocabulary, so a phrase like extract function can be discussed in a sentence. The catalog works best as a reference you return to, though reading the early sections in order builds the intuition behind the rest.
- 4
Code smells as signals, not rules
Smells are surface symptoms, such as long functions, duplicated logic, or classes that do too little, that hint at deeper design trouble. Fowler presents them as prompts for judgment rather than automatic triggers. The useful skill is noticing a smell, asking whether it causes real pain, and choosing a move only if it helps.
Limitations
Common criticisms include the length and repetitiveness of the catalog, which can feel more like a reference manual than a narrative. The second edition's JavaScript examples and modern language features may look unfamiliar if you work in another ecosystem, though the principles transfer. The book focuses on local, code-level improvement and says little about large-scale architecture, distributed systems, or database migrations. Some readers also find the advice on when to refactor hard to apply without experience.
Questions Readers Ask
- Is Refactoring still relevant if I work in a different language?
- Yes. The first edition used Java and the second uses JavaScript, but the moves and reasoning are largely language-neutral. Expect to translate the examples into your own syntax. The catalog's names are widely used, so the vocabulary carries over to most object-oriented codebases and many others.
- Should I read the first or second edition?
- Most readers should choose the second edition. It reorganizes the catalog, updates the advice, and uses JavaScript, which many people find more approachable. The first edition is mainly of interest for its historical influence or if you specifically want the Java examples.
- How does it compare to Clean Code?
- Clean Code focuses on how individual names, lines, and functions should read, with a strong opinion-driven tone. Refactoring is more procedural: it gives you named moves and the steps to perform each one safely on existing code. Many developers read both, using Clean Code for taste and Refactoring for technique.
- Published
- 1999
- ISBN
- 9780201485677
- Difficulty
- intermediate
- Category
- Tech
Book details and cover from Google Books.
Ready to read Refactoring?
Get your copy on Amazon, or listen to it on Audible. We earn a commission if you buy through these links.