Coder Social home page Coder Social logo

bobthemighty / expensereport-level-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christianhujer/expensereport-level-2

0.0 1.0 0.0 316 KB

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

Shell 2.78% JavaScript 5.87% Ruby 3.38% C++ 4.68% Scheme 5.32% Python 5.19% Perl 4.35% C 4.32% PHP 4.75% Objective-C 5.22% Java 5.28% Common Lisp 6.00% Lua 4.73% Haskell 5.24% Scala 5.40% Smalltalk 7.13% Groovy 3.72% Fortran 7.22% Clojure 5.01% Tcl 4.40%

expensereport-level-2's Introduction

ExpenseReport Level 2

** WARNING! ** This repository will be rebased and force-pushed whenever there is a change to the (Level 1) ExpenseReport at https://github.com/christianhujer/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.
  • Add JSON as an output format.

History

So you looked at the Expense Report code. And you knew you had to refactor it. But you didn't. You left it as it is.

Weeks later, you revisit the code, and notice that it's gotten worse. A colleague has added a new feature, output in HTML, without refactoring the code. It's a real mess. And you gotta work with it now.

Process

  1. ๐Ÿ“š Read the code to understand what it does and how it works.
  2. ๐Ÿฆจ Read the code and check for design smells.
  3. ๐Ÿง‘โ€๐Ÿ”ฌ Analyze what you would have to change to implement the new requirement without refactoring the code.
  4. ๐Ÿงช Write a characterization test. Take note of all design smells that you missed that made your life writing a test miserable.
  5. ๐Ÿ”ง Refactor the code.
  6. ๐Ÿ”ง Refactor the test.
  7. ๐Ÿ‘ผ Test-drive the new features.

Supported Languages

The ExpenseReport Level 2 kata currently exists in the following languages:

Incomplete

These languages are incomplete on Level 2:

  • BASIC (Commodore BASIC, Commodore 64)
  • BASIC (Locomotive BASIC, Amstrad CPC)
  • Go

Planned languages

(in no particular order and with no guarantee)

  • Eiffel
  • Elm
  • Erlang
  • Logo
  • Modula-2 (once the linker starts working again)
  • Oberon
  • R

Languages explicitly not planned

  • Brainfuck
  • Malbolge
  • Whitespace

Solutions

To see solutions, switch to the branch solutions.

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. 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.

expensereport-level-2's People

Contributors

christianhujer avatar jonreid avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.