Saturday, January 22, 2011

Collaboration Not Pairing

One of the tenants of Extreme Programming is pairing on all production code. At first, it seems to make perfect sense. Four eyes on all code is better than two, right? There is another partner to help solve issues, take over when one is tired, and to keep each other honest. What could be wrong with that? Plenty. I feel that pairing is good in spurts of time or as I like to say, "Collaborate not pair".

I want someone to help me on the hard problems. I don't need someone peering over my shoulder to make sure I'm coding a for loop correctly. I think big picture. I want a pair to help with the design and make sure it is sound. The physical act of coding might have some hard problems too and I would like a pair for that as well. But, for the mundane boilerplate code, I don't need to watch someone type that.

I believe you need a mix of alone time on a problem and together time to exchange ideas. Pairing constantly stops that and it's easy to fall prey to a stronger partner's ideas even if those ideas are bad. The stronger personality wins. This should not be the case. But, I've seen it many times on XP projects. A pair put into production code that was clearly not good and hard to maintain. The very thing pairing is supposed to prevent.

This doesn't mean I don't want four eyes on all code either. I think a collaborator should read over every line of code that is written in isolation and ask questions. This is where time away is helpful. The partner brings an outside perspective than if the pair was sitting side by side. This prevents group think or one partner overbearing another. There's also the case where some developers are intimidated working with someone all of the time. They need to have space to properly think. These developers can be prone to letting a stronger partner always have their way. Again, not what we want.

As you can see, I'm not against pairing, but against constant pairing. Collaborate when necessary and make sure to leave time to think in isolation. You need both. You can't be all one side or the other. Either one all of the time is not healthy. But, how much collaboration versus alone time is needed? This is where you have to use your best judgement. Agility is about thinking and finding the right solution for the right situation. It's not a one size fits all world.

No comments: