What is a Code Review?
A.KA. – Code Analysis Review. It is an ongoing process to allow developers to improve code quality. This is defining moment where they can spot code smells, serious vulnerabilities and be able to promote readability, maintainability, security, and extensibility of codes or in short-high cohesive and loosely coupled codes.
“Many Eyes are Better than One”
It is also a moment where all developers will be involve better, improve communications, and be better developers. It is a sharing and learning moment by looking at their own code base.
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding
The DON’TS in Code Review:
- Don’t focus on blame or avoid the “Finger of Blame”
- Don’t get emotional – avoid embarrassing developers or belittle one’s work,
- Code review is not a Witch Hunt – don’t try to identify weak developers
- Management should not berate developers for creating poor code.
- Don’t redesign the whole code base.
- Don’t judge based on how you would have coded it. There are many ways how to code. Focus on maintainability.
Benefits of Code Review
- Improve the quality of the team,
- Improve the quality of communication,
- Improve the quality of the code,
- Find coding problems,
- Opportunity to learn, and
- Promotes collective code ownership.
How to Conduct Code Review
- Be sure to have coding standard in the organization (eg. SOLID, DRY, GRASP),
- Find things to laud/praise (Positive things) first ,
- Find things to fix,
- Look for common problems(repeatable patterns), not one-off issues,
- Review 200-400 lines at a time in every hour before fatigue sets in.
- Start refactoring if necessary.
Hope this information is useful. Share it with your friends!!!