Monday, July 28, 2003

From code reviews to writers' workshops. I've never found code reviews to be useful, despite the extensive literature vouching for their effectiveness. The reviews I've participated in typically degenerated into arguments about how many spaces in a tab stop, prima donnas attempting to impose their idiosyncratic programming style on everyone else, and managers advocating some once-useful but now outdated technique (Hungarian notation, casting NULLs, etc.). Worst of all is the adversarial nature of code reviews - reviewers seek to find as many things to criticize as possible while developers attempt to defend (or rationalize) their code.

The phrase "writing code" is more than a metaphor - programming is a form of creative writing. Good code and good writing share the same characteristics: accuracy, conciseness, understandability, and internal consistency. Both are usually written the same way by a process of successive revisions and edits- except we call these "refactoring" and "iterative development" instead of treating them as a natural part of programming. It's more than coincidence that great programmers are at least good writers.

While I won't go as far as advocating a Master of Fine Arts in programming I believe that many of the techniques writers use to become better writers can also help us become better programmers. Instead of code reviews we need writers' workshops where we can read and discuss our peers' code. These would focus on improving the participants' code and learning from each others work rather than on scoring points with the boss by spotting errors. It would also give us a chance to size up our peers - who are the really talented people we want to work with in the future and who are the lousy programmers who are baffled by any coding task more complex than running a code wizard.