Expense Report Refactoring Kata

In Christian Hujer’s Expense Report Legacy Code Refactoring kata, you get to inherit an existing codebase in need of a new feature. It, however, has no tests, and can’t easily be tested.

Kata Instructions

For this exercise, we’ll be mostly following Christian Hujer’s instructions that will have us discussing and taking notes as we go.

New Feature to Build

Steps

  1. 📚 Read the code to understand what it does and how it works.
  2. 🦨 Read the code and check for design and code smells. Make a list of all code and design smells that you find.
  3. 🧑‍🔬 Analyze what you would have to change to implement the new requirement without refactoring the code.
  4. 🧪 Write a characterization test. Expand your list of code and design smells. Add those smells that you missed earlier and discovered now because they made your life writing a test miserable.
  5. 🔧 Refactor the code.
  6. 🔧 Refactor the test.
  7. 👼 Test-drive the new feature.

Source Code

Here’s the link to the source code for this exercise.