Refactoring Dojo: The Gilded Rose Kata

Last week Rafael de Castro (@rafadc) and I facilitated a Coding Dojo for the Madrid Software Craftsmanship meetup group (219 members and growing every week!) in which we participate. The idea was to make a Dojo in which we could practice refactoring.

Iván Stepaniuk standing in the back, and some Madrid Craftsmen and Craftswomen at work!
Iván Stepaniuk standing in the back, and some Madrid Craftsmen and Craftswomen at work!

It went pretty well! This is the second time we meet in the MediaLab Prado in Madrid, a “citizen laboratory for the production, research and dissemination of cultural projects that explore collaborative forms of experimentation and learning that have emerged from digital networks.”, founded by the Madrid City Council, COOL!

For the Dojo we have chosen a well known Kata called “Gilded Rose”, it is a very simple piece of software that updates the quality value of the items in a store following some simple business rules. The problem is that the code sucks, we are asked to add a new feature but the code is so horrible that you don’t even know where to start.

Rafael de Castro Facilitating the Refactoring Dojo
Rafael de Castro Facilitating the Refactoring Dojo

We had limited time, so we choose JavaScript, that way nobody would have to install anything special on their computers, and everybody has a text editor and a browser to launch Jasmine, right?. We distributed several pen drives with the same copy of the code plus a working test runner. And because we wanted to focus on the refactoring techniques I also included the tests, already passing.

The schedule

(at least the planned one!)

Protip: ask the people to bring their [WeirdAppleConnector] to VGA adapters if they have them! Also, for the final “show&tell”, it’s easier to collect the code in pen drives again than to connect many laptops to a projector.

The code

The Kata code is on my github account, where you can also find a folder named ‘solutions’ that contains 8 of the solutions that were written during the Dojo. In most of the cases, 3 people participated in writing the code because pairs where swapped in the break.

Happy hacking!


istepaniuk

About Iván Stepaniuk

I have been creating software for more than twenty years in a wide variety of stacks, languages and platforms. I advocate Software Craftsmanship and the Agile Manifesto, this has been a great motivation and helps me to continuously reinvent myself as a better developer that makes better quality software.

See my about page


©2014 Iván Stepaniuk. Licensed under CC-BY-SA
Site powered by Jekyll and the Noita theme, built with Foundation
RSS Feed