Thursday 21 August 2008

What have the agilists ever done for us?

Cue a gratuitous link to Monty Python material, almost guaranteed to distract a geek:

Right, what I actually wanted to do was sing the praises of — or at least mention — the greatest benefit that agile development has brought me: a reduced tolerance of duplication. Not only that, but an improved ability to identify it, in all its forms.

Hmmmm... what do I mean by "in all its forms"? Obviously, there's the straight copy-and-pasted code duplication. And then there's code that's been copied and then very slightly changed, or had its variables renamed. But some of the trickiest problems I've tackled have come from different bits of code that have shared assumptions and knowledge that aren't immediately obvious. Being able to spot that early and isolate it and/or make it explicit can be immensely valuable.

I sometimes wonder whether I've become too fixated on duplication, to be honest. I find myself getting unnecessarily aggravated at work when I perceive others to not care as much about it as I do. Am I just being pompous in thinking that my colleagues don't care about it enough? Yes, almost certainly. Besides, we're judged by our actions more than our words and the evidence suggests I've done very little to tackle the issue in my day to day work. Well, very little beyond avoiding duplication in new code. I've barely scratched the surface of our legacy issues.

Getting back to the topic of this post — that of agile's influence — what first drew my attention to duplication as Evil #1? It's hard to say. I don't think it was test-driven development's emphasis on refactoring; I was aware of refactoring before that. However, I do suspect it played a part. Really, I think TDD just seeded a crystal. All the elements were already there, swilling around in my noggin, but TDD and refactoring brought them together for some kind of mini-epiphany. Reading Test-Driven Development By Example probably helped too. As much as I'd like to limit my praise of Kent Beck, that was a pretty good book.

What about your experiences? What's the biggest benefit agile brought to your development life? Assuming it brought any, that is... ;-)

4 comments:

Wilka said...

I think my dislike for duplication came from reading Pragmatic Programmer. Specifically the DRY (http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) section.

On a related note http://www.codeplex.com/CloneDetectiveVS is great for finding the 'obvious' type of duplication in a code base, but even better than that it can highlight the duplicated code in the IDE - so you know when you're about to start editing some code that's duplicated. Although I've only just started using it, so it might turn out to be lame.

Mal said...

Actually, that's a point. I think *you* played a part in my dislike of duplication too, possibly via the Pragmatic Programmer book. :) I'd never actually read it myself, although I've finally got a copy now.

As for Clone Detective -- good spot! I noticed it in your shared items yesterday. Let me know how you get on with it. :)

Ashley Frieze said...

One of the main Agilistaists (possibly Fowler) said "Change your job or change your job" and I think that's probably the biggest thing I've learned.

I'M NOT SHOUTING about it, though :)

Mal said...

Shouting about it? Who's shouting?