Coding Dojo: Enhancing Legacy Code
Coding Dojos are sessions were participants are invited to participate in a programming challenge. They get the opportunity to practice Extreme Programming techniques such as Test-Driven Development, Simple Design and Pair Programming. In this dojo, the audience will be asked to concentrate on adding features (while preserving existing functionalities) to a Java project that has not been written with testability in mind. In other words, we will work on legacy code. The Randori format will be used to let as many participants as possible do actual coding.
The classic mecanisms of a Coding Dojo will be used.
- 30 mins: introduction
- what is a Coding Dojo?
- description of the project
- description of a couple of refactoring techniques (based on Working Effectively With Legacy Code, by Michael Feathers), especially: adding sensors (getters/sensing variables), decoupling (setting dependencies), ‘safe refactorings’, and creating a test harness
- 45 mins: actual programming
- one of the pair switches out every 5 mins and gets replaced by someone from the audience
- the copilot is the one leading the coding, with help from the audience
- 15 mins: retrospective
- what techniques have been used?
- can you use them on your own projects?
The project that will be refactored is a simulation of the game Monopoly. Though simple, it has been found in previous sessions that it is of appropriate complexity for such a short timeframe. That said, at the time of the conference, we might have another project ready.
- Participants will discover programming techniques for handling legacy code. These techniques will not be introduced by the presenters, but found by the pair doing the programming, with the help of the audience. This approach has been found to be very efficient in past editions.
- We are also hoping that this session will help all those that are being told “well, TDD is nice on new projects, but we have this whole code base and we have no choice but to keep doing what we were doing before.” They should be able to answer “well, I tried a couple of techniques, let’s see if I can pair program with you on this”