• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Assembly
  • License
    Other
  • Created over 3 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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:

  • 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
  • Gleam
  • 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 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:

  • Please credit me, last but not least to retain the opportunity for people to experience this exercise in as many programming languages as they are interested in.
  • Share it under the same license.
  • Using this as training material should be allowed, even if the trainer is charging money for their time.

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.

More Repositories

1

aceunit

AceUnit (Advanced C and Embedded Unit): A comfortable C code unit test framework. AceUnit is JUnit 5.x style, easy, modular and flexible. AceUnit can be used in resource constrained environments, e.g. embedded software development.
C
44
star
2

sclog4c

Simple configurable logging for C
C
19
star
3

makehelp

Built-in doxygen-style help in makefiles
Perl
14
star
4

expensereport-level-2

Level 2 of the Expense Report Legacy Code Refactoring Kata. Someone added a new feature (HTML output) without refactoring a bit!
BASIC
14
star
5

jcardmock

Mock implementation of the Java Card API 3.0.4 in order to test Java Card applet code without a card or simulator.
Java
10
star
6

jcunit

Unit testing framework for JavaCard
Java
6
star
7

makelint

A simple lint for Makefiles
Makefile
4
star
8

XSlides

An XML based system for presentation slides
JavaScript
3
star
9

isheadless

Go library to check whether the system is headless
Go
2
star
10

assert

Assertions for unit tests in Golang
Go
2
star
11

KeilWrapper

KeilWrapper is a set of wrapper programs for the Keil C51, C166 and C251 toolchains in order to get their compilers, librarians and linkers compatible with make (especially GNU make).
C
2
star
12

EE-Bootcamp-FragilityExample

Fragility Example as performed on 2015-07-26 for the Equal Experts Pune Bootcamp
Java
2
star
13

expensereport-csharp

The Expense Report refactoring example in C#
C#
1
star
14

expensereport-java

Expense Report example in Java for Katas / Coding Dojos
Java
1
star
15

playground

My personal public playground
Java
1
star
16

makedist

reusable make support for creating distribution archives. Currently supports .tar.gz, .tar.bz2, .zip and .deb.
Makefile
1
star
17

expensereport-kotlin

Expense Report example in Kotlin
Kotlin
1
star
18

cross-and-qemu-smoketest

A smoketest suite for cross compilation with gcc and clang and cross execution with qemu
Assembly
1
star
19

expensereport-javascript

Expense Report example in JavaScript for Katas / Coding Dojos
JavaScript
1
star
20

queue-tdd-java

Queue kata from the LV1871 Coding Dojo with Robert "Uncle Bob" C. Martin
Java
1
star
21

video-index

video-index for Clean Coders Videos
XSLT
1
star
22

intercept-go

Go library to intercept stdout and stderr, useful in testing
Go
1
star
23

tdd-examples

Examples for the Test-Doubles and Mocking session and Perennial Systems for the SimplyTech / Nelkinda Meetup
Java
1
star
24

JAceBenchmark

Benchmark suite to perform system, JVM, XML and XSLT benchmarks
C
1
star