Platinum Partner
java,testing

TDD: Useful When New On a Project

Something which I've noticed over the last few projects that I've worked on is that at the beginning when I don't know very much at all about the code base, domain and so on is that pairing with someone to TDD something seems to make it significantly easier for me to follow what's going on than other approaches I've seen.

I thought that it was probably because I'm more used to that approach than any other but in Michael Feathers' description of TDD in 'Working Effectively With Legacy Code' he points out the following:

One of the most valuable things about TDD is that it lets us concentrate on one thing at a time. We are either writing code or refactoring, we are never doing both at once.

It also temporarily removes us from the feeling of drowning in all the new information which is typical at the start of projects. In a way it reminds me of the 'Retreat Into Competence' pattern from 'Apprenticeship Patterns' as it gives us a chance to regain composure and take in all the new information.

We can probably make a much more useful contribution if we only need to understand one small piece of the system rather than having to understand everything which can often be the case with what Feathers coins the edit & pray approach to development.

It's still necessary to spend some time trawling around the code base working out how everything fits together but I'm now more aware that it's also really useful to take some time to just focus on one much smaller class or piece of functionality.

Perhaps also something to keep in mind the next time I'm pairing with someone who's new to a project that I've been working on for a while.

From http://www.markhneedham.com/blog

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}