Welcome!

SOA & WOA Authors: Liz McMillan, Ali Hussain, David Tishgart, Kevin Benedict, Jerry Melnick

Related Topics: SOA & WOA, Java, XML, AJAX & REA, Open Web, Security

SOA & WOA: Blog Post

What’s Not So Obvious About Code Reviews

Effective code reviews

When conducting code reviews then you should determine if code reviews are just something you check off your list or have they actually gotten you closer to better quality code? Your motivations and attitudes towards code reviews can greatly affect their effectiveness.

When my son started preschool at three years old he was expected to put his shoes on by himself. One of the first directions his teacher gave me was to say nothing if he put them on the wrong feet. I soon came to understand the wisdom of this approach. He wore his shoes on the wrong feet for a few days before figuring out how to get it right all by himself. The important thing is that once he learned he never got it wrong again. People retain information better when they are allowed to learn for themselves rather than if the information is spoon-fed to them.

Many years ago I started a new job with a consulting firm as a junior programmer. As soon as I had written just a little bit of code they scheduled a review for it. It was obvious that they wanted me to comply with standards and catch my mistakes. The code review was uncomfortable, I felt that I was being judged and I can't remember that I learned anything from it that improved the quality of my code on the long run. Now many years down the road as a manager of a technical team I am a stickler for code reviews myself. However, I've learned that being successful with code reviews depends on why you have them and how they are conducted.

As a manager I almost never code myself but am responsible for code quality. I love being part of collaborative code reviews because they are an enormous learning opportunity for me. I get to see what's in the code for myself and hear different points of view. At one point I was leading two different teams and code reviews were a great way to get developers on each team familiar with each other's code. When appropriate, I included our business analysts in some of the reviews so that they could verify some of the most confusing logic. Junior team members were able to share their opinions without fear. Sometimes they would notice someone else's work and liked it so much that they signed up to rework their code voluntarily. I noticed that the team was largely able to come to consensus all by itself and my role during the reviews was that of an observer and guide.

I tracked the outcome of our code reviews as tasks in our project management tool to make sure that we followed through on all of the decisions that we made during these reviews.

I believe that if code reviews are conducted collaboratively and in the spirit of learning and self-improvement then they can lead not only to better code but also to better communications and improved morale.

More Stories By Salma Saad

Salma started her career back in 1993, working on Steve Jobs NeXT platform and moved on to Java when it was at the ‘bleeding edge’. She has worked as a consultant for more than ten years, working primarily on website development projects for a large variety of clients. In addition to her fascination with everything technical she also has a strong interest in developing her leadership and management expertise. She enjoys living in Chicago and being the mother of two rugrats, ...um boys and is currently working for Arc Worldwide/Leo Burnett helping fortune 500 clients build awe-inspiring websites.