## TL;DR

Refactoring (Martin Fowler, 1999) improves code structure without changing external behavior. It's a disciplined technique for cleaning up code, reducing technical debt, and making future changes easier. Refactoring is NOT rewriting — it's a series of small, safe transformations with tests as safety net.

## Core Explanation

Common refactorings: Extract Method (break large function), Rename Variable, Move Method, Replace Conditional with Polymorphism, Introduce Parameter Object. Code smells (indicators): Long Method, Large Class, Duplicate Code, Feature Envy, Primitive Obsession. Refactoring with tests: run tests before and after each small change. IDE refactoring tools: IntelliJ, VS Code, ReSharper.

## Further Reading

- [Refactoring (2nd Ed, Martin Fowler)](undefined)