Refactoring Golf is a game designed to stretch your refactoring muscles and get you to explore your IDE to see what's really possible using shortcuts and automation.
Refactor Golf is a type of practice originally from @jasongorman. There are of course different code bases, or golf courses :), where we can play refactor Golf. This repo uses @daviddenton TakeHomeCalculator as it' playing field.
This repo contains the TakeHomeCalculator code for different languages, at the moment it contains
- Java
- Kotlin
- Typescript
Choose the one that suits you. The exercise is basically the same.
You need a partner, or caddy :-) , for this exercise who will take notes on the number of points you collect during the exercise.
The kata repo, for your chosen language, contains several numbered "Holes". They are all based on the same single exercise. Each hole carries on from the last for a single exercise - which is the application of a tax amount to a set of monetary amount.
Your goal is to safely and efficiently as possible refactor the Hole-X code to look like the Hole X+1 code. You must aim to do it in as few "strokes" as possible.
A "stroke" is essentially a change made to the code, and every stroke costs you points.
Your pairing partner should carefully score you as follows:
- 1 point for every change made to the code using a shortcut or automated IDE feature (e.g., an automated refactoring, code template, or Find/Replace)
- 2 points for every manual edit. Note that a single "edit" could cover multiple lines of code.
- Double points for every change made while the code cannot pass the tests after the previous change.
- Zero points for code formatting (e.g., deleting whitespace or optimizing imports).
Allow yourselves a maximum of 2 attempts at each round to determine your best score.
The original Golf Refactor, including the above instructions, come from @jasongorman's Refactoring Golf repo where he uses Fibonacci as exercise. The HomeCalculator exercise for the Golf refactor comes from David Denton The Typescript version of comes from @codurance repo