Skip to content

Project - Refactoring "Dirty" Code using TDD

Goal

Practice real-world refactoring:

  1. write characterization tests (what the code does today)
  2. refactor in small steps
  3. keep tests green

Approach

  • find a messy function (long, many branches)
  • write tests for current behavior
  • refactor into smaller functions

Tips

  • don’t change behavior while refactoring
  • use coverage to find untested paths
  • commit frequently

If this helped you, consider buying me a coffee β˜•

Buy me a coffee

Was this page helpful?

Let us know how we did