Home

Awesome

ExpenseReport

License: CC-BY-SA The ExpenseReport legacy code refactoring kata in various languages.

This is an example of a piece of legacy code with lots of code smells. The goal is to support the following new feature as best as you can:

Process

  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.

Supported Languages

The ExpenseReport example currently exists in the following languages:

Planned languages

(in no particular order and with no guarantee)

Languages explicitly not planned

Undecided Languages

There are many more programming languages than in the list above. Find a more complete list on Wikipedia.

Other plans

Solutions

To see solutions, switch to the solutions branch.

Warning The solutions branch will be rebased!

Credits and License

I first encountered the ExpenseReport example during a bootcamp at Equal Experts. I also have seen the ExpenseReport example being used by Robert "Uncle Bob" C. Martin. However, he seems to not be the original author (https://twitter.com/unclebobmartin/status/1537063143326855176?s=20&t=lh_vVb9jUQmY6PYG50974w) I have tried to research its origins but so far I have failed. If you know who has first come up with this example, please get in touch with me.

As I was asked for the license conditions, I have decided to put this under CC-BY-SA, with the following considerations:

Disclaimer: As stated above, I did not come up with the original version. The original author is unknown to me. The CC-BY-SA license thus can only cover my contribution: Recreating the Java version from memory, creating the versions in other programming languages than Java, and keeping them consistent.