Coding Dojo Challenge: RefactoringEmily Bache
Workshop: 90 minutes
In this hands-on session we will be working on a rather smelly piece of code which helpfully has a fairly comprehensive suite of automated tests. Refactoring is one of the key skills of Test-Driven Development, and this is your chance to really practice it. The idea is not to rewrite the code from scratch, but rather, by taking small refactoring steps, gradually transform the code into a paragon of readability and elegance.
We’ll be stepping into the Coding Dojo together, which is a safe place designed for learning, where it doesn’t matter if we make mistakes. In fact all the code will be thrown away afterwards. You should feel free to experiment, try out different refactoring approaches, and get feedback from your peers. The great thing about this Kata is that since the tests are very good and very quick to run, they will catch every little refactoring mistake you make. You should experience how programming is supposed to be – smooth, calm, and always minutes away from committable code. The last part of the session is the retrospective, when we discuss what we’ve learnt, and how we can apply our new skills in our daily production code.
The code kata we’ll be looking at is “Tennis”, and the starting code is available here: https://github.com/emilybache/Refactoring-Katas/Tennis. (Java, Python, C++ etc). If you want to practice using your familiar development tools, please download the code and set up a project in advance of the session. Otherwise you can just come and use the cyber-dojo practice environment, which I’ll have set up in advance.