Tuesday, May 17, 2011

XP 2011 Open Space session: Teaching TDD to a Team so that it sticks

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

2 comments:

  1. Nice post! I think i have (over)heard some of the concerns that you mention throughout my work experience and i tend to disagree with them.

    In detail:
    "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"

    I don't think the team needs the consent of a PO. Why would a PO care (unless he/she is strong on Agile)?
    The team should select the tools and methods they find most appropriate on their way to become really good developers.
    The PO should be concerned about quality and predictability in terms of delivery dates.

    "The examples from training were easy, but the own project is really hardcore programming"

    I think that is not a valid argument. Any project that does not apply TDD will become hard to test and that usually happens real quick. So these projects will always naturally develop into 'hardcore' projects.

    "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"

    True, but this statement also describes a not functioning team, or to cut that short: a not-team.

    ReplyDelete
  2. Hi,

    all of these concerns are real ones in the sense that one or more of all the OpenSpace participants had heared them from their developers or in a coaching situation.

    The Product Owner cares about his backlog and the velocity. If he knows about the advantage of TDD, of course he will spend on the topic, since he will later get more efficient work from the team.

    Of course, in a green field apporach you will not have this problem, when the code is written from the beginning with TDD and all the good technical practices.

    ReplyDelete