January 29, 2008

...Learn TDD with Codemanship

"Are We Doing Too Much Refactoring?" - I'll Give You 3 Guesses

All too often, the dilemna I face is that teams I work with are expected to learn new and complex skills like test-driven development, refactoring, OO design, UML, and so on, but are also expected to achieve their usual levels of productivity.

So when the first iteration results in less functionality being delivered, the first question that inevitably comes wafting across from the general direction of the project manager or business sponsor is: "Are the developers doing too much refactoring?"

And it's about this point that 90% of projects go awry, as far as design quality and maintainability are concerned.

So let me take a few moments to answer this question thoughtfully:

No.

It's not that the developers are doing "too much" refactoring. That's not what's slowing them down. It's that they doing refactoring slowly. And that's because they've never done it before.

As a coach, I could wade in and fix the problems for them to help improve their velocity in these early stages. But in the medium-to-long term, this isn't going to help them. What happens the next time a similar problem comes up? Will they know what to do? Or will I have to wade in and fix it again?

And if I do, then doesn't that sort of defeat the purpose of my involvement? I'm there to help teams build their development capability. If I'm actually solving the problems for them, then I'm not really helping them to improve much.

But the drum beat is pounding in our heads, and the powers that be are standing over us whispering "is it ready yet?"

Just occasionally, clients get it. They realise that time spent helping developers to learn how to solve these problems for themselves will pay dividends later on. Give a man a fish and he'll eat for a day. Teach him to catch his own fish, and... well, you get the picture.

But he may have to go hungry for a day or two until he gets the hang of it.

And it takes a bit of courage to have faith that you'll get there in the end, and it will all be worth it. Because we so easily lose our nerve and revert to our bad old ways, usually long before we were in any danger of overdoing the learning.

I find we too readily underestimate just how far we can take quality before we're really overdoing things.
Posted 10 years, 5 months ago on January 29, 2008