Coding Dojo on Legacy Code

At CITCON Amsterdam last WE, Willem van den Ende and I facilitate a Coding Dojo session on both Mockito and Legacy Code.

Willem and I thought that we had missed some of our goals (especially demonstrating Mockito), but still many people at the closing session mentioned that they enjoyed it :-)

Coding Dojo with Legacy CodeWe tried to prepare a bit before diving into the session. However, in practice, it became a bit chaotic, as many participants tried to make their opinion heard. This was very different than when I do that in trainings or even at Valtech. I guess this is because there were quite a few people (~20) and most of them were rather experienced and strong-headed (I guess they wouldn’t be at such a conference otherwise!).

Coding Dojo with Legacy CodeWe managed to have a quick retrospective at the end. Here are some of the things we learnt:

  • We need to prepare the session better; half of the session was spent fixing an existing bug in the original application, instead of adding features. Also, Willem wanted to take advantage of Mockito, which was quickly forgotten as people concentrated on fixing the bug.
  • At first, do Safe Refactorings (the ones that can be done automatically by Eclipse and such tools), though you still need to be careful of what you are doing
  • It is OK to add code, not OK not remove code from the legacy application
  • Add collaborators using setters to facilitate testing
  • However, be careful: getters and setters can quickly get out of hand
  • Singletons are bad, not just because they make code hard to test, but also because they create secret coupling
  • Apparently, many (bad) coders want to write singletons and static methods (which are both frown upon in the context of testing), simply because they do not want to type the ‘new’ keyword
  • We could try to rotate the copilot on a longer basis (for example, every 10 mins, instead of every 5 mins for the coder)
  • I (Eric) got concerned that the Coding Dojo format prevents participants from thinking; facilitating the session sometimes seemed to be like herding cats
  • it was clear that many people was interested in working on legacy code
  • in the end, a Coding Dojo with an appropriately complex application seemed like a good way to learn about handling legacy code
  • I need to experiment a bit more with Coding Dojo for Legacy Code, but I feel that the format is rather good. Next year, we’ll do better!

    About Eric Lefevre-Ardant

    Independent technical consultant.
    This entry was posted in citcon, facilitation, tdd. Bookmark the permalink.