The Artima Developer Community
Sponsored Link

Java Community News
How Do You Manage Code Reviews?

10 replies on 1 page. Most recent reply: Aug 22, 2006 10:10 PM by Glyph Lefkowitz

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 10 replies on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

How Do You Manage Code Reviews? Posted: Aug 17, 2006 10:42 AM
Reply to this message Reply
Summary
Code reviews can help detect problems early, but take time away from coding. How do you maximize the benefits and minimize the costs of code reviews?
Advertisement

In Code Reviews, a java.net article, author Srivaths Sankaran looks at the costs and benefits of code reviews. He begins by saying that code reviews help detect problems early:

Problems in software are easier to fix the earlier they are detected. ... A code review is an excellent checkpoint that can help flush out erroneous assumptions and gaps in reasoning. It helps minimize the impact of a problem by means of early detection.

He claims that thorough testing is not a satisfactory substitute for code reviews:

While testing is an excellent way to improve the quality [of software], testing alone is not enough. For one, as shown by McConnell in Code Complete, it is statistically impossible to completely test a non-trivial software project. Testing must be bolstered by up-front code reviews.

Having described the benefits of code reviews, he turns his attention to the costs:

Conducting a code review, however, can also be a costly proposition, due to the involvement (interruption) of several individuals and their loss of productivity. With the context switch and the cost to the project as a whole, code reviews can add a sizable lengthening of the project timeline.

How do you manage code reviews in your project? When do you do them, and when don't you? Whom do you invite? How do you run them? How do you maximize the benefits and minimize the costs of code reviews?


Kevin Klinemeier

Posts: 7
Nickname: zipwow
Registered: Dec, 2002

Re: How Do You Manage Code Reviews? Posted: Aug 17, 2006 1:27 PM
Reply to this message Reply
Our code reviews are a combination of pair-programming and code review. In a nutshell, we meet in a conference room with a projector, run Eclipse and make changes as we discover them.

We have several rules:

1. No more than 5 people in the code review.
2. All changes "suggested" are made in the code review and checked into the source control when we're done.
3. No one leaves code review with new tasks, unless they're added to the project schedule.
4. Unit Tests are executed during the review to ensure that our changes are not destructive.
5. The meeting does not "go long" if we're not done.

We meet twice a week for an hour each time. We decide what to review at the beginning of the meeting, explicitly EX-cluding any topic that feels too much like current development effort (it's a code review, not a group problem solving session for a current feature). Unfinished changes are either picked up at the next review, or prioritized as tasks.

I always found that code reviews were abandoned when we got "very busy." Given that we're almost always "very busy", that ultimately meant we didn't do code reviews. With this approach, the schedule impact is constant and easier to manage.

Ivan Lazarte

Posts: 91
Nickname: ilazarte
Registered: Mar, 2006

Re: How Do You Manage Code Reviews? Posted: Aug 17, 2006 5:01 PM
Reply to this message Reply
I like those rules, it reinforces the collaborative aspect of programming. Sometimes in wishy-washy review systems the original developer just gets a "look into these suggestions if you have some time". Which of course is the surest way to frustrate everyone.

Cameron Purdy

Posts: 186
Nickname: cpurdy
Registered: Dec, 2004

Re: How Do You Manage Code Reviews? Posted: Aug 17, 2006 5:37 PM
Reply to this message Reply
Very similar to what we do, except usually only 2 or 3 people. The projector is definitely a great tool for code reviews.

Peace,

Cameron Purdy
http://tangosol.com/

David Sitsky

Posts: 2
Nickname: sits
Registered: Aug, 2006

Re: How Do You Manage Code Reviews? Posted: Aug 17, 2006 7:19 PM
Reply to this message Reply
I just added this response to the original java.net article, but thought I'd reproduce it here as well:

A lot of these principles in the article were taught to me when I worked at Cisco Systems many years ago, and I am a big supporter of code reviews, having seen their effects first-hand.

One downside with conducting "formalised sit-down" code reviews is the requirement to physically get people around a table, which I know from experience becomes a big hurdle for development teams.

I developed Codestriker, which is an open-sourced web-based code reviewing system, to get around this hurdle (and the use of paper/print-outs). Reviewers create a new code review, via a web-based interface, and emails are sent to all participants.

Using Codestriker for your reviews minimizes paper work, ensures that issues, comments and decisions are recorded in a database, and provides a comfortable workspace for actually performing code inspections.

It also means that developers are free to review the code on their own time, and also they don't have to be physically located at the same place.

There are other tools out there which assist in code reviews, which this article perhaps could have highlighted further. In any case, the codestriker home page is located here:

http://codestriker.sourceforge.net

The "resources" link on this page also refers to other systems.

Christophe Chuvan

Posts: 1
Nickname: ceecee
Registered: Sep, 2005

Re: How Do You Manage Code Reviews? Posted: Aug 18, 2006 2:42 AM
Reply to this message Reply
I'm intrigued by online reviews, because as you say, getting the right people to sit together at the table can be frustrating. However, I wonder whether some important "value-add" information is being missed from the lack of actual face-to-face discussion?

Jeffrey Burch

Posts: 1
Nickname: hcrub
Registered: Apr, 2006

Code Reviews Produce Maintainable Code Posted: Aug 18, 2006 4:45 AM
Reply to this message Reply
The most important aspect of code reviews in to produce maintainable code. Developers tend to produce better code because they think about the justification of coding decisions and there aren’t a lot of TODO hacks in the code.

Code reviews also expose code that didn’t follow the design that was hopefully reviewed by the same developers that are in the code review. While the code could run through all the junit tests, it doesn’t meet the long term goals of the project.

The last question that should be asked during a code review is “Would you take ownership of this code?” from all the developers sitting in the code review. The answer should yes this is maintainable code.

serge desmedt

Posts: 1
Nickname: sde
Registered: Oct, 2004

Re: How Do You Manage Code Reviews? Posted: Aug 18, 2006 10:00 AM
Reply to this message Reply
Where not doing code reviews in groups, but rather each developer on his own because we are a small shop and this way we can review more. Of course, when adapting the code the reviewer and reviewee can sit together to discuss the change.

Here is some more eplanation on what we are doing:

http://sdesmedt.wordpress.com/2006/06/29/implementing-peer-code-reviewing/

Serge Desmedt

David Sitsky

Posts: 2
Nickname: sits
Registered: Aug, 2006

Re: How Do You Manage Code Reviews? Posted: Aug 20, 2006 9:51 PM
Reply to this message Reply
It is preferable to have people physically together. There have been times when I have sat next to the developer in front of Codestriker, and recorded our comments in that way, as it was simply more efficient. Most of the time though, this isn't necessary.

Its the same issue with working in a team physically in the same place (much higher bandwidth for discussions), or working in a team physically separated, but communicate with phone/IM/email.

Sometimes, the luxury of a choice isn't there!

Cheers,
David

Kannan Goundan

Posts: 18
Nickname: cakoose
Registered: Nov, 2005

Face-to-Face vs Online Posted: Aug 21, 2006 3:05 AM
Reply to this message Reply
At my previous company, we used Codestriker in the following way:

1. Author puts code up online, notifies reviewers.
2. Reviewers submit comments.
3. Author responds to comments.
4. Pre-meeting resolution of simple issues. Author can "accept" a comment (commit to fixing the issue). Reviewer can invalidate his own comment (possibly because of the author's response to a comment).
5. In-person meeting with author and reviewers to resolve remaining issues.

Step 4 gets rid of a lot of the easy issues that would otherwise unnecessarily use up everyone's time in Step 5.

Glyph Lefkowitz

Posts: 12
Nickname: glyph
Registered: Nov, 2003

Re: How Do You Manage Code Reviews? Posted: Aug 22, 2006 10:10 PM
Reply to this message Reply
At Divmod, we have a very lightweight system for doing code reviews, which is a sort of asynchronous version of pair programming.

It's described in detail here:

http://divmod.org/trac/wiki/UltimateQualityDevelopmentSystem

The short summary is: all work takes place on branches until the branch represents a coherent change, and every change is reviewed by at least one other developer before being merged to the main line of development.

Flat View: This topic has 10 replies on 1 page
Topic: How Do You Manage Code Reviews? Previous Topic   Next Topic Topic: New JSF Portlet Bridge Project

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use