Refactoring

noun

say it: “ree-FAK-tur-ing” /riˈfæktərɪŋ/

Changing the shape of code, such as renaming or pulling out a method, without changing what it does.

What is refactoring?

Refactoring is changing the shape of code without changing what it does: renaming a variable so it says what it holds, pulling a few lines out into a method of their own, moving a job to the class that owns its data. It's done in small steps, with the tests run after each one, so a step that changes the behavior is caught at once.

In a sentence

  • “After some refactoring, the checkout function had clear names and every test still passed.”

Level: Apprentice · More Software Development terms at this level

Updated