Home > View Post

Code Reviews are not optional

I have to get this out there. Code reviews are not optional things that you do in a utopian world when there's plenty of time. Newflash: There is no such thing as a utopian world and there's never plenty of time. I can think of only one scenario where code reviews aren't mandatory and that's if you pair (or peer) program.

I was recently speaking to a friend about a project where he'd just encountered a 4,000 line class with a single 800 line method. I think that particular class probably needs some Refactoring. You guessed it though, code reviews aren't being enforced on this project due to "schedule pressure". It drives me nuts when a Manager says "we'll have to skip the code review, there isn't time". What a false misnomer this is and it really saddens me:

  • code reviews will save you time
  • code reviews are a platform for knowledge transfer (of both technical and domain knowledge)
  • developer's learn not to keep making the same mistakes
  • the end product will be more maintainable and of higher quality
Let me reiterate what I'm saying in my first point: code reviews will always save you time. That's right. (Project without code review) takes longer than (Project with code review). Therefore, the less time you have the more you need to be doing code reviews.

I don't always agree with Jeff Atwood but a while ago he wrote a post about code review that I really wish I'd written myself: Code Reviews: Just Do It.

What is a code review

A code review is not the developer leading you quickly through a days work in 2 minutes. For me, there are three stages to a code review:
  1. Developer quickly takes the reviewer through his work
  2. Reviewer goes through the work in detail on his own at his own workstation
  3. Reviewer feeds back to the Developer with a list of required changes and suggestions
Finally, the reviewer should always re-visit the code to confirm that the changes made satisfy the feedback.

I actually enjoy code reviews and their naturally competitive spirit. I'm embarassed if my reviewer picks up lots of little obvious violations which motivates me to get it right first time and I relish the discussion when we have differing approaches to situations. And best of all, occasionally I find a great new approach that I hadn't seen before.

As Jeff said, Just Do It.

Tags: Other

Josh Post By Josh Twist
5:16 AM
28 Jul 2006

» Next Post: Screen Resolutions
« Previous Post: Using images with the PropertyListView

Comments are closed for this post.

© 2005 - 2022 Josh Twist - All Rights Reserved.