Code Review : A Simple Guide

code_review
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
  1. Improve the quality of the team,
  2. Improve the quality of communication,
  3. Improve the quality of the code,
  4. Find coding problems,
  5. Opportunity to learn, and
  6. Promotes collective code ownership.

How to Conduct Code Review
  1. Be sure to have coding standard in the organization (eg. SOLID, DRY, GRASP),
  2. Find things to laud/praise (Positive things) first ,
  3. Find things to fix,
  4. Look for common problems(repeatable patterns), not one-off issues,
  5. Review 200-400 lines at a time in every hour before fatigue sets in.
  6. Start refactoring if necessary.

Hope this information is useful. Share it with your friends!!!