|
Re: Where Did All the Beautiful Code Go?
|
Posted: Mar 31, 2006 2:08 AM
|
|
> In theory peer review of code is great. The problem is > that it's easier for the reviewer to focus on variable > names, braces, commenting style etc., than it is on > finding bugs.
Yes, I agree and I think that the core problem of peer review was always finding two or three people who had the time, inclination and capability to look at your code and make useful comments. The reality was, as you say, that most reviews were themselves 'quick and dirty'. Did the code compile? Does it meet the company's basic coding standards? etc. Indeed, if the code includes all the relevant unit tests then there shouldn't be any bugs either. In fact, these are all preconditions that should hold before the peer review takes place
None of that addresses the 'beautiful code' problem though. It's quite possible for code to meet all the above criteria and still be 'ugly'.
Nevertheless, there are three potential benefits that should be the aim of peer review. + Firstly; Defensive Coding: if people know they have to stand up and defend their code in detail then they are more likely to write code that can be defended. + Secondly; Communication: There is nothing like looking at what they're writing to tell you what your colleages are actually doing. 'Show me the meat' is, I think, the American colloquialism. + Thirdly; Education: We all, more or less, know how to code but we can only code what we know. Knowledge of best practice, patterns, specialist tools, libraries, APIs, etc., etc. is much more thinly spread. Reviews are an ideal opportunity to communicate such knowledge, particularly when it can be applied to concrete examples of new code.
This theory is all very well but when, in practice, you can't find people who are prepared to put the time in to doing it properly then it remains just theory. (Much in the same way that it's largely impossible to find the right customers; the ones who have the time and knowledge to discuss what it is that you're trying to code for them in the first place.)
Communication seems to be the key missing ingredient.
|
|