Login

Log in with one your accounts

Contribution

We are happy you want to contribute to DXKB. Please choose your preferred way

All Articles
Nov 11, 20194 min read

Code Review

Code Reviews are an important practice for checking each other's code. The goal is to uncover potential mistakes that could slip through testing.

What Is a Code Review

A Code Review is a software quality assurance practice in which developers check each other’s code, usually before merging the code. Code Reviewing saves time and money as the team is able to find potential bugs that can slip undetected through testing. It is more difficult and more expensive to fix bugs in later stages of development. Code Reviews let the team learn and gain new information and a new point of view. It also accelerates the growth of junior developers as they see real world current code examples.

Code ReviewSource: Code Like A Girl: The 7 steps to a complete Code Review

The reviewer checks the code for:

  • Changes in the code
  • Mistakes, or potential mistakes
  • Consistency with the assignment
  • Quality of comments
  • Adherence to coding standards
  • Security Breach

Ready to put this knowledge into action?

Visit our website and learn how DX Heroes can help your business succeed.

Why You Might Want the Code Review

Code Reviewing is a very important tool for developing process. It improves code quality and makes the codebase more stable. For developers, Code Review can be a great opportunity to get feedback from others (it can be done by pair programming).

Code Review:

  • Helps developers work together and build relationships
  • Can be a way to onboard and train new team members
  • Enables experienced developers to mentor less experienced colleagues
  • Reduces the product cost as issues are identified at an early stage
  • Improved software quality
  • Creates a natural knowledge share process across the team
  • Can be a part of a job interview - Testing how advanced the developer is by how many issues they identify

Problems the Code Review Solves

How to Implement the Code Review

  • Code Reviews are usually done via pull requests, and before merging. There are many tools for creating pull requests, such as:
  • Pick one of two possible approaches:
    • Develop something and send it to another developer to check it.
    • Checking the code during pair programming.
  • It is very important that developers talk to each other, and that they all understand what is the code supposed to do.

8 tips for Code Reviewing:

  1. Know what to look for, and ensure that you understand what the code does
  2. Test the code before Code Reviews
  3. Do not review for more than 60 minutes at a time or you lose focus
  4. Review fewer than 400 lines at a time
  5. Set goals and expectations
  6. Automate where possible with the right tools
  7. Establish a systematic method of how to fix mistakes
  8. Give constructive feedback that helps rather than just criticize

Common Pitfalls of the Code Review

  • Developers do not want their code to be reviewed because they rely on automated tests more than on the coleague’s opinion.
  • Developers merge their own pull requests to save time.
  • The Code Review does not help when the developer does not check the code properly. They may trust the author expect them not to make mistakes. Ensure to review the code carefully, we can all make mistakes occasionally.
  • The reviewer focuses more on stylistic mistakes instead of functional ones.
  • If the team is not very homogeneous and has no clear rules, they can waste time with arguing over meaningless trivia.
  • The team spends too much time Code Reviewing where the author creates a pull request for every little code change. Try to limit the creation of pull requests to important code changes.
  • If the reviewer does not perform the Code Review immediately, they can lose track.

Resources for the Code Review

Was the article helpful?

Want to write for DXKB?

Feel free to contribute. People from DXKB community will be more than happy.

Avatar

Prokop Simek

Contribution

We are happy you want to contribute to DXKB. Please choose your preferred way