Code Reviews (was: Defending the Python lanuage...)
mcherm at destiny.com
Fri Feb 1 21:49:25 CET 2002
> Actually, if you are *good* at what you do, then code review, whilst still
> beneficial, is not nearly *that* beneficial. Things like code review (IMO
> :-)) is there for the 25-50% of programmers who just plain shouldn't be in
> the industry - what they generate is just absolute garbage - code review
> will hopefully stop the code from getting into Unit test and beyond the
> point of redemption :-).
I completely disagree. There are lots of reasons why code reviews are
good for EVERYONE, not just the incompetents, but I'll just list a few:
* Code reviews spread knowledge of the code around.
You don't have TIME to sit down and read every piece of code that anyone
at your company writes, but on the other hand, if only the author has
ever worked with the particular piece of code which she wrote, then what
happens when she's hit by a bus? Code reviews ensure that SEVERAL people
are intimately familiar with the design of each piece of code in the
system. Perhaps she wrote some utility method which you could leverage
in a different part of the code... without spreading the knowledge
around you wouldn't know about it.
* Code reviews are a chance to learn.
Sure, you're an experienced, skilled developer. You know all kinds of
tricks and patterns and can sling code almost as fast as you can type.
But the ONLY ways to get like that are (1) fooling yourself, or (2)
continuous learning. A good programmer is always trying to pick up on a
new idiom, an as-yet-unfamiliar pattern, or just a good hint on creating
a readable style. Reading books like "The Pragmatic Programmer" is a
good start. Attending code reviews can be just as good. It's in that
code review where you're sitting down with other skilled programmers and
discussing the quality/style/details of a particular bit of code. If
you're the local guru, then you're probably mentoring the newer
programmers in these sessions (good in and of itself!), but even if
you're the most experienced and skilled developer in the group, you're
still going to learn some new things from the process (unless you're (1)
* Code reviews give you a chance to show off.
Everyone likes to write really GOOD code. Something that's clever yet
readable, highly optimized yet nicely organized, using surprisingly
appropriate algorithms and perfectly chosen data structures. But it's
even MORE fun if you can show it off (to other programmers, of course,
as they're the only ones who can really appreciate it). And code reviews
provide this opportunity. If you are handed 20 pages of code and after
preparing for the review by reading it over (you DO read the code ahead
of time don't you <poke-in-the-ribs>), you are just downright impressed
-- it's readable and brilliant -- then tell the author how good it is.
They worked hard to achieve that, and deserve a little recognition.
Sorry for going on about this, but I'm the local self-appointed
-- Michael Chermside
PS: For those XP'ers out there, I include pair programming as a limit
case of code reviews.
More information about the Python-list