javatarz / expensereport

The ExpenseReport legacy code refactoring kata in >50 programming languages (Ada to Zig)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExpenseReport

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:

  • Add Lunch with an expense limit of 2000.

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)

  • ABAP
  • Amiga E
  • AMOS BASIC
  • APL
  • More Assembler implementations (arm, aarch64, i686, powerpc, powerpc64, mpis, mips64, sparc, sparc64, risc-v, etc, usually on Linux)
  • Carbon
  • CLIPS
  • Cluster
  • Concurnas
  • Curry
  • Dark
  • Eiffel
  • Elm
  • Erlang
  • Flix
  • Forth
  • Gosu
  • Hack
  • Hare
  • Java Byte Code / JVM Assembler
  • Lobster
  • Logo
  • Mercury
  • Modula-2 (once the linker starts working again)
  • Oberon
  • OCaml
  • Pony
  • PureScript
  • R
  • Reason
  • REBOL
  • Scratch
  • SNOBOL
  • TeX
  • Unison
  • WebAssembly

Languages explicitly not planned

  • Brainfuck
  • False
  • Malbolge
  • Whitespace

Undecided Languages

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

Other plans

  • Make sure that all languages are providing the identical challenge. To be practical, this will require the removal of the timestamp side-effect.
  • Provide the time-stamp side-effect on a separate branch.
  • Provide a test setup (without test) on a separate branch so that folks can choose whether they want to include the setup work in the kata or not.
  • Provide a level 2 challenge for creating an HTML report besides the Plain Text report.

Solutions

To see solutions, switch to the solutions branch.

Warning The solutions branch will be rebased!

Credits

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.

About

The ExpenseReport legacy code refactoring kata in >50 programming languages (Ada to Zig)


Languages

Language:Assembly 15.8%Language:Kotlin 8.8%Language:Makefile 5.4%Language:BASIC 3.8%Language:TypeScript 2.9%Language:Shell 2.8%Language:Fortran 2.3%Language:Ada 2.2%Language:Smalltalk 2.1%Language:C# 2.1%Language:COBOL 2.1%Language:Dart 2.0%Language:Java 1.8%Language:JavaScript 1.8%Language:Swift 1.7%Language:Objective-C 1.7%Language:Python 1.7%Language:XSLT 1.6%Language:Clojure 1.6%Language:Zig 1.6%Language:Visual Basic .NET 1.6%Language:C++ 1.6%Language:Scheme 1.5%Language:Lua 1.5%Language:Common Lisp 1.5%Language:PHP 1.5%Language:C 1.5%Language:Perl 1.5%Language:Haskell 1.4%Language:D 1.4%Language:F# 1.4%Language:Tcl 1.4%Language:Rust 1.3%Language:Elixir 1.3%Language:Scala 1.3%Language:Pascal 1.3%Language:REXX 1.2%Language:Groovy 1.2%Language:FreeBasic 1.2%Language:Julia 1.2%Language:PostScript 1.2%Language:Go 1.1%Language:Nim 1.1%Language:Raku 1.0%Language:Prolog 0.9%Language:Ruby 0.9%