On XP 2011 conference in Madrid, I invited to an Open Space session named "Teaching TDD to a Team so that it sticks". I stated the problem below, and a couple of interesting people showed up and gave very helpful hints, among them Charlie Poole, the inventor of NUnit, as well as Patrick Kua and Alexandru Bolboaca. I have integrated some hints from an earlier discussion of the topic with Emily Bache and Johannes Brodwall at the ACCN in Oslo.
The problem description:
Let’s take a couple of Scrum teams who have already been doing Scrum for a while, but are still lacking some technical practices. Agile coaches are convinced that Test Driven development (TDD) would help them create better and more solid code.
Some have had the opportunity to attend a TDD or XP in general training session, but only very few have taken back something to their work.
What could be the reasons for that?
· TDD is not intuitive, but you have to practice a time to overcome the first problems
· If they are the only ones in their teams, it is difficult to stick to it, not having whom to ask
· There is also pressure to take on constantly work from the product backlog, and work will be first slower than without TDD – they need the consent of their Product Owner
· Maybe it has not been communicated enough that management and Product Owners would tolerate some initial productivity loss, and at which time
· The examples from training were easy, but the own project is really hardcore programming J
· In some project setups, it may not be the same developers who profit from good code, as bugs are corrected by someone else => no closed feedback loop
How can we now bring a good training/coaching solution in?
· All participants should be voluntarily doing the training
· The training should be done focusing on one team at a time
· The training can be 2 or 3 days off site – not in the normal work environment
· To explain TDD well, code examples that are not from the own project are used at least the first 2 days
· it is helpful if code examples are from the main programming language that the participants are using
· The proper UT frameworks need to be installed on the developers' machines when they are starting
· A code retreat could be used for the first phase – this is a couple of developers sitting together and working on the same problems several times, deleting the code in between – outcome is that it is reasonable to create good maintainable code
· A coding dojo is also a good technique – a group of developers solving a problem, doing TDD, but only one pair at a time will actually work on the code, while the others can look on the projector, and one dojo participant will change from time to time
· After the participants have some good idea about TDD and first practice, it will be good for credibility and transfer to their own work to look at some own code examples from the team’s real life project
· The trainer needs to prepare for that, so he/she can work with that code
· The workshop needs to bring the mindset change to “it is fun working with TDD”
· After the initial training, there must be an agreement with the Product Owners how much time can teams spend per week/per iteration on practicing TDD
· Follow-ups take place in the normal work environment: coach pairs with people in a team on real programming problems
· From time to time a code retreat or coding dojo to learn more interesting things (refactoring, cleaner code) and practice TDD in volunteer group will lead to strengthen the practice and amplify the learning