🧪Refactoring
Also known as Refactor, Code Refactoring
A change to how code is written. What it does stays the same.
Think of it like
Think of it like tidying your room. All your things are still there, just easy to find.
Example
Emma's 200-line function is hard to read. She splits it into five short functions with clear names, and all her tests still pass.
Why it matters
Code is read far more often than it is written. Tidy code is faster to fix and safer to change.
Definition
Common mistake
Key takeaways
- 1Same behaviour. Only the shape changes.
- 2Tests keep it safe. They prove nothing broke.
- 3Small and often. Not one big rewrite.