Repaso
EspaƱol

What is refactoring?

Options

  1. Adding new features to the existing code of a system
  2. Changing the structure of code without changing its behavior (Correct option)
  3. Rewriting the whole application in another language
  4. Fixing the bugs that appear after a release to production

Answer

Changing the structure of code to make it cleaner without changing what it does

Why

Refactoring improves the inside of the code (names, structure, duplication) while the behavior seen from outside stays exactly the same.

Examples: renaming a variable, extracting a function, splitting a big class.

Tests are your safety net: run them after each small step to confirm nothing changed.

Remember

Refactor = better structure, same behavior.

Key terms

Practice this question in Repaso