Code review etiquette

With the process of submitting for code reviews and also doing code reviews, I’ve jotted some  etiquette or “time saving” tips if you will, on the process. This is going to address more of the interpersonal skill part of it, than the technical aspect. I am avoiding addressing the technical aspect of code-review since well, in my opinion there are a zillion ways to address a technical problem, and each coder assumes she is taking the best approach. It sucks that I lost my ace reviewer, it was fun knocking that extra line of code and seeing a beautiful piece of code checked in.

As a reviewer: 

1. Please be prompt with the code-review. There is someone waiting at the other end to submit a change.

2. If a “modification” goes beyond an iteration or two its either time to draw up that chair and share the cube  or pick up the phone and discuss.

3. When providing feedback, please be specific, its best to provide examples in terms of code. That way you are making it clear to what you as a reviewer expects.

4. Be kind, as a reviewer you may come across a lot of levels of coding capabilities. Some reviews may just require simple changes to make the code more readable, and in others it may need major  code refactoring.

5. If you are just starting to code review someone’s code, then don’t pick on ever thing that you think ought to be changed. Start in steps, once the submitter improves on the code, increase the level of expectation.

6. Please don’t file bugs for every enhancement, lay it out as a suggestion that the submitter can think about, if the change is mandatory, then please file a bug.

7. Please encourage the submitter for good work done. This keeps the tone positive.

8. When discussing ‘problem solving’ from [2], start off my asking the submitter as to why she preferred the approach rather than assuming that your approach is the better way.

9. If you think the submitter is not clear about what you are trying to convey, take the initiative and say “let me know if you need help”

10. Have fun as a reviewer. There’s always something to learn from someone.

As a submitter: 

1. Please give your code  a thought, the reviewer is taking time out to help you better YOUR code.

2. When the reviewer suggests something or files a bug, try not to take it personally!

3. if you think some change is not required or can be held off in another CL, start a discussion and state your reasons clearly.

4. Involve the reviewer, if you are unsure about something, take the initiative and ask her what she thinks about it. Remember reviews are about collaboration.

5. Don’t forget to have fun. Remember its your code. Make it pretty, make it functional, also keep it clean.

Me: Wow look at those patents.

Co-worker: Makes it all feel so impersonal.