Good Code is Like a Good Book
I am a reader. I love books, especially crime novels. Some are amazingly complex, some are intriguing, and some are silly but fun. However there is one thing that makes me crazy: plot holes. I really hate gaps or inconsistencies in a storyline that go against the flow of logic established by the story. Sometimes I wonder whether an author even read what he wrote — or at least had a good editor review his writing!
I am a programmer. In addition to writing code, I also read source code of other programmers. And I read lines of code as if they were books (less exciting for sure). All these ifs/elses, functions, classes, methods should be logical. In some cases they aren’t. It’s like a book with dozen of characters with weird names that you aren’t able to remember. Moreover, you always have to go back several pages to remember, "who was this guy again?"
By definition, code review is used for catching bugs and design errors before the code becomes part of the product. Statistics show that code reviews can eliminate up to 85% of bugs (average is 65% which is also a great result)¹. Code review dramatically helps in the quality of products as well as code clarity. It also helps junior developers to understand some common solutions and code standards and vice versa. With senior programmer guidance, young developers improve their skills and learn best coding practices.
The only real disadvantage of code reviews is simply the time needed. Typical code review rates are about 150 lines of code per hour². Inspecting more than couple hundred lines may slightly decrease the error-finding rate.
So the obvious question is whether code reviews are worth the investment of added time. In my opinion, definitely. We must remember that code review improves code quality — and more importantly, improves programmers themselves. At Tivix, we believe in continuous improvement of code, and continuous improvement of programmers. Good code reviews help both.
1) Jones, Capers (June 2008). “Measuring Defect Potentials and Defect Removal Efficiency”. Crosstalk, The Journal of Defense Software Engineering. Retrieved 2010-10-05.
2) Ganssle, Jack (February 2010). “A Guide to Code Inspections”. The Ganssle Group. Retrieved 2010-10-05.