Code review: the solution to the problem of "WTFs/minute"
I recently wrote about me being a hypocritical Christian because I sometimes cuss (only in my mind, most of the times, of course; but my attitude has greatly improved since writing that blog post ).
Christians are not supposed to cuss, right? That’s what I was taught. Christians are supposed to possess the virtue of self-control. And, I think, cussing is a manifestation of a lack of self-control – lack of love at the very root, of course, because “love is patient and kind, bears all things, endures all things…”.
… in programming
In the programming world, there is this joke that says, “The only valid measurement of code quality is WTFs/minute”.
Now, let’s imagine a world where programmers do not take that as a joke. A world where programmers do not believe that self-control is a virtue — where programmers believe in their hearts that “WTFs per minute” is the only valid measurement of code quality. — How would we manage to prevent the catastrophy that that belief, and the resulting action, would make?
CODE REVIEW of course!!!
If our code base went through peer reviews, then the owner of the whole code base is not each of the individuals in the team, but the whole team itself.
When someone will be heard saying WTF (or any sign of displeasure) while reading code, each individual in the team will think of that as either an attack on the whole team (which includes the attacker of course ), or as an indicator of displeasure on his own code.
No one in the team will think that the one saying WTF is critisizing someone else.
Instead, everyone will assume that the displeased programmer’s mind has these thoughts:
“What was in our minds when we did this!! ”
“Why did I do this crap!”
Catastrophy prevented!!! Yehey!
I remember this conversation from the third of The Crafstman series of Uncle Bob Martin:
I asked: “Jerry, do you do this with your own code too?”
Jerry scowled: “We work as a team around here, so there is no code I call my own. Do you consider this code yours now?”
“Not anymore.” I said, meekly. “You’ve had a big influence on it.”
“We both have.” he said, “And that’s the way that Mr. C likes it. He doesn’t want any single person owning code…
Of course pair programming and mob programming can also prevent the catastrophy.