Andreas Leidig has run a Legacy Code Retreat in Germany recently and written about the experience here.
Thanks to Andreas for running a Legacy Code Retreat without me! This is another step in the direction of LCR becoming a standard practice technique for programmers worldwide.
When will you run your first Legacy Code Retreat?
This time we had a smaller, but very determined group, who emphasised their interest in the two techniques that most people seem to like most: Golden Master and extracting pure functions.
Alex decided to port the code base to C++, but because he used a C++11 feature, the code base doesn't compile on most systems. "It works on my machine," he says.
With thanks to AgileMinds led by Erik Talboom for organising the event and AE for hosting it, the second ever (but first announced!) public Legacy Code Retreat ran to great success in Leuven, Belgium on November 26, 2011.
It wasn't supposed to be the first Legacy Code Retreat, but Johan Martinsson and his team organised the event and Orange Labs hosted us, et ce n'était pas du tout prévu de lancer Legacy Code Retreat en français!
We had a large group of about 40 people working in Java, C#, Smalltalk, PHP and, I think, Python, who enjoyed the chance to learn a few new techniques, practise with a variety of their colleagues and somehow put up with my French. I can tell you that the day certainly tired me out.
Great! We want everyone to run a Legacy Code Retreat. Here's what I do.
So far, I've followed a similar formula to Code Retreat. The basic framework includes this:
Now everyone who runs a Code Retreat does things slightly differently, and I have two important suggestions for change that I use in Legacy Code Retreat:
I almost forgot! http://www.github.com/jbrains/trivia. Like any good bit of legacy code, you'll find no instructions, and possibly some bugs. Good luck.
I run Legacy Code Retreat with more guidance than a typical Code Retreat. I have so far used these exercises in this sequence:
As always, write whatever tests will help you do these things safely and correctly. Whatever you do, do what you don't normally do!
After each iteration, throw away your changes except for the Golden Master exercise. I recommend that people keep their Golden Master to help them with the other exercises.
For the last two iterations of the day, keep the changes after iteration 1, but switch partners.
The Trivia Game has one feature that can help us quickly and easily generate some helpful characterisation tests: it displays running commentary about the game on the console. After the first iteration of get to know the code a little, I invite people to spend 20 minutes generating output for 10,000 different games (use a specific sequence of seeds for the random number generator!) as a Golden Master. They can use these game logs to build some confidence that changes haven't completely screwed up the code base by generating the game logs after a change, then comparing the test run against the Golden Master. I strongly recommend that you try this exercise yourself as a kata before you run your Legacy Code Retreat. You can figure it out! Just remember that the same seeds for random number generators from different languages on different machine architectures will generate different streams of numbers, so you can't just copy the game logs from one computer to another. I tried that.
Add your comments!