Getting a good code review is all about preparation. Before you ask someone for a code review your code should be:
- Cleaned up so it’s easy to read
Getting a good code review is also about accepting the reviewer’s advice, so don’t get defensive. You are asking them for help and you have to be ready to take it. The purpose of the code review is to make the code better, not to get someone else to tell you that it was perfect already. You are there to talk about why you wrote the code the way you did and get feedback. When you are done with the code review, the other person should feel comfortable talking about your change and explaining it to someone else.
Accepting criticisms from other people can be difficult. It has a lot to do with how you are feeling and how receptive you are to hearing what the other person has to say. Mike Pilato from the Subversion team has called the code reviews he received “invaluable,” but he also admits:
“Some days you may wake up and you’re cranky and you think, ‘I know the minute I send this patch off, here comes that code review and I’m gonna get smacked around for it.’ A lot of how you receive code review is all about your own attitude.”