in reply to Advocacy of code reviews: how the heck do you do it?

There are many excellent points above by both kvale and dragonchild. Here is my two cents for what its worth.

There are a number of ways to go about code review, and I have participated in each kind and found they all have their benefits and drawbacks.

  1. Group Code Review

    This tends to get really boring, really fast (as most meetings here in the corporate world do), especially if it is too detail oriented. However, I have seen a lot of value (given the right mix of people) when more high level elements of the code/implementation are discussed and debated in this format. Now discussing code at too high a level, I would guess, would not work in your world since it would basically be a discussion about your assignment. However, if you stick to how it is implemented, and not what is implemented it may work out. It could also be thought of as a post-assignment exercise if that helps.

  2. One on One Code Review

    This is personally my favorite and have proven to me to be the most fruitful. The basic idea is you sit down with someone and explain your code to them while they ask probing questions about why you did this, and how you did that, etc. A lot of times, your best revelations come from the act of explaining your code too. I have also seen this work with more than one other person as well, although sometimes that degrades into too much side discussion.

  3. Private Code Reveiws

    You give me your code, I go somewhere and review it. This is what you seem to be proposing above. This method can be really valuable, but tends to take a lot of time and many times requires the reviewer to really know their stuff. To be honest, I have only ever known a few people in my career (PerlMonks not included) whom I have felt doing this with was worthwhile.

As I said, I have seen all three of these approaches work, and all three of them fail miserably. The single most important element to success though, is an open mind and a willingness to take and give criticism (preferably constructive) on the part of all involved. Nothing will derail this process sooner, than a reviewee who can't take a little criticism or reviewers who are afraid to speak up.

-stvn
  • Comment on Re: Advocacy of code reviews: how the heck do you do it?

Replies are listed 'Best First'.
Re^2: Advocacy of code reviews: how the heck do you do it?
by radiantmatrix (Parson) on Oct 18, 2004 at 14:10 UTC

    I like your ideas, stvn, but I have a problem where I work: no peers. At least, not in Perl. There is only one other person in the organization who knows any Perl -- she is just beginning, and uses it only for administration tasks. Now, I've reviewed her code, at her request, many times. She has tried to review my code, but simply doesn't know enough Perl yet.

    What options do I have for code review?

    radiantmatrix
    require General::Disclaimer;
      radiantmatrix

      Well, not having peers does present a problem here. If you have enough other coders/programmers/developers in your organization then it might be possible to just talk a little more high level with them instead of code/language specific. Really most C based languages (Java, Perl, etc.) are similar enough that a good programmer (with an open mind) can understand your perl code. I have caused much envy among Java programmer friends showing them elegant solutions using anon. subs and such, which would take a ridiculous amount of code/time to do in Java.

      I would find the best <other language> programmer you can find, and try Option 2, since a lot of the benefits of that comes from you having to explain your own code, you will likely benefit even if they don't offer too much thought.

      Personally I would really like to see a Code Review section here on Perl Monks, but that might not help you with work-related code.

      -stvn
        I have caused much envy among Java programmer friends showing them elegant solutions using anon. subs and such, which would take a ridiculous amount of code/time to do in Java
        I'm envious that you work with people who would be envious... I desperately want to work with people who aspire to improve themselves, sadly this isn't the norm...