A code review is a process of source code verification to check is code does what is supposed to do and is it meet criteria set by rules (acceptance criteria, quality and so on)
Code review is an important technique,because:
1. It helps me as developer to :
- write better code
- verify did I understand acceptance criteria correctly.
- have better quality
- to be consistent and
- to follow agreed approach and practices
- increase confidence to other stakeholders (other developers, QA and so on ) that code does what is suppose to do .
This talks covers how to do code review and how to give feedback.
From this talk I learn ( re-learn or remind myself) about code review that:
I should focus on:
- Functionality :
- Is it doing what is suppose to do ?
- Is meet acceptance criteria and non-functional requirements ?
- Code usability:
Code review is too late for design discussion and suggestion like:
- Is it in right place?
- Is it use right data structure , pattern ?
- is code is overly complex or over-engineered?
- Is use existing library or introduce new dependencies ?
- You should have some code review manners rules written somewhere, where you should include things like:
- Discuss changes, not people
- Be specific
- Suggest alternatives.
- Don't be rude and don't offend people (directly or indirectly).
- Example of offend people indirectly is by using words like obviously ,simply.
- Refer to code not person This code not your code.
- and so on.
It is important to give feedback that focus on improve code based on agreed standards without blame or attack directly or indirectly person, because in the end our goal is to deliver good enough code that deliver value to product.
- I use IDE (IntelliJ IDEA has awesome inspector feature) , Sonar and plugins like Checkstyle and Findbugs
- I ask my colleague to double check my code (walktrough style)
- At work we are doing code review in real time during pair programming.