Refactoring by Martin Fowler
Refactoring by Martin Fowler

Business · 1999

What is Refactoring about?

by Martin Fowler · 8h 45m

Open in Superbook

The short answer

Refactoring is Martin Fowler's catalog of techniques for improving the internal structure of existing code without changing its observable behavior. First published in 1999 in collaboration with Kent Beck and others, and substantially revised in a second edition in 2018, it gives programmers a shared vocabulary — a taxonomy of named moves, from Extract Method to Replace Conditional with Polymorphism — that makes the process of cleaning up code discussable, teachable, and reliable.

Refactoring by Martin Fowler
Refactoring by Martin Fowler

Talk to Refactoring like its author wrote you back.

Get the ideas that fit your life — not generic summaries.

  • Chat with the book
  • Audiobook-style main ideas
  • Adapts to your life and goals
  • Helps you take action
Open in Superbook

Refactoring, in detail

Refactoring is Martin Fowler's catalog of techniques for improving the internal structure of existing code without changing its observable behavior. First published in 1999 in collaboration with Kent Beck and others, and substantially revised in a second edition in 2018, it gives programmers a shared vocabulary — a taxonomy of named moves, from Extract Method to Replace Conditional with Polymorphism — that makes the process of cleaning up code discussable, teachable, and reliable.

The central argument is that good software is not written once and left. Code that works is not the same as code that is well-structured, and working but poorly structured code becomes progressively harder and more expensive to change. Fowler calls this accumulation "technical debt," and refactoring is how you pay it down: not in large, risky rewrites, but in small, safe steps, each of which leaves the code slightly more understandable and slightly easier to modify. The key discipline is maintaining a green test suite before, during, and after each move. Without tests, refactoring is just guessing.

The bulk of the book is a reference catalog: roughly 60 named refactorings, each with a motivation, a step-by-step procedure, and example code. The procedures are unusually concrete — move the cursor here, rename that variable now, check the tests at each step. This precision is not pedantic; it is the point. Fowler is arguing that code improvement can be made into a rigorous practice rather than an art form practiced only by the experienced few.

Refactoring is not a cover-to-cover read. Most readers absorb the first two chapters, which make the conceptual case and introduce the core concepts, and then use the catalog as a reference. The second edition uses JavaScript for its examples and adds discussion of automated refactoring tools. The book influenced a generation of developer culture: the idea that code has "code smells" that signal where refactoring is needed is now part of the standard vocabulary of software engineering.

The big ideas

  1. 1.

    Refactoring means changing the internal structure of code without changing its observable behavior. Small, safe steps rather than large rewrites.

  2. 2.

    A green test suite is the prerequisite. You cannot refactor reliably without tests that tell you immediately if you've broken something.

  3. 3.

    Code smells are surface indications of deeper problems — long methods, duplicate code, feature envy, mysterious names — that signal where to refactor first.

What it explores

Chat with Refactoring

Ask questions. Adapt it to your life. Get answers based on your goals.

Download on the App Store