Track 13 · Lesson 9 of 12
Refactoring safely
Improve the structure of working code without changing what it does, using tests as a safety net and characterization tests for legacy code.
You will be able to
- Define refactoring and explain why behaviour must not change during it
- Refactor in small steps, running the tests after each one
- Apply common refactorings: extract function, replace a conditional chain with a lookup, remove duplication
- Write characterization tests that pin down the current behaviour of legacy code before changing it
Included with a Formula Quest membership
It has 3 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.