Insights

At DVT, we run regular online events focused on the latest technology trends within the IT industry and invite guest speakers to share their knowledge and insights on various topics. The DVT Insights Events aim to enlighten you, educate you and often, provide a new view on a burning issue within the technology space.

Code Reviews: Improving Software Quality and Team Collaboration
Velaphi Mathebula

Code Reviews: Improving Software Quality and Team Collaboration

Thursday, 20 February 2020 12:53


source: https://bluefletch.com/take-aways-from-a-friday-code-review/

Understanding Code Review

According to Wikipedia Code review (sometimes referred to as peer review) is a software quality assurance activity in which one or several humans check a program mainly by viewing and reading parts of its source code, and they do so after implementation or as an interruption of implementation. At least one of the humans must not be the code’s author. The humans performing the checking, excluding the author, are called “reviewers”.

Benefits of Code Reviews

Peer reviews are one of the most powerful software quality tools available to developers in the software testing life cycle. When done right, this can assist in finding and resolving potential bugs during the software testing process. This stage reduces the more expensive process of handling, locating and fixing defects during the later stage of software development or after software testing solutions have been delivered to the users.

Code Quality Improvement

The misconception is that when conducting code reviews, one only checks for potential defects, the solution design, or whether the coding standards of the team are adhered to. It’s understandable for developers not to deviate from the plan; however, reviews offer a unique opportunity for the development team which involves the following:

  • Better code quality
  • Early defect detection
  • Knowledge sharing
  • Improving the proposed solution
  • Maintain consistency
  • Opens discussion for strengths and weaknesses of a design
  • Helps team members adapt their mental model of the system as it’s changing
  • Domain knowledge awareness

As code reviews expose developers to new ideas and technologies, they write better code and better code. https://www.atlassian.com/agile/software-development/code-reviews via Atlassian

Focus on Code Fundamentals

Reviews should focus less on how things are done or someone else’s preferences on how to solve a problem but should review the fundamentals and innovation in the software development process. We all want clean code that is well-formatted but that leads to a common problem of reviews being more focused on how the code is styled, spacing, just to mention a few but overlooking the logic. This may be caused by a lack of context from the reviewer and some based on how “things are done”.

Balancing Consistency and Innovation

Consistency of the code is good, but it shouldn't come at the expense of best practices, fundamentals, and innovation in the code review process. When reviewing code, we must use our knowledge and creative thinking to come up with solutions that improve code quality and adhere to code review best practices, instead of rigidly sticking to how things have always been done. This approach will not only keep the job interesting but also encourage learning and process improvement with respect to the software development architecture.

Who Should Review Code?

Who has the right to review code? Every member of the development team should participate in the code review process. Junior team members can use it as an opportunity to learn about the software testing life cycle and domain knowledge, while more senior individuals are there to ensure that the architecture is not compromised. They can suggest better solutions, maintain code standards, and identify potential bugs. This inclusive approach gives everyone the opportunity to learn from each other, hold each other accountable for writing quality code, and correct bad code habits, improving the overall quality of the software testing solutions.

Avoiding Bad Developer Habits

Examples of bad software developer habits:

  • No code structure
  • Copy and paste blindly
  • keeping unused code
  • Names that don’t indicate the intended purpose

Code reviews are not a platform to settle developer ego scores. Whether it's comments on the code that force changes or attempts to prove seniority within the team by showcasing Github statistics, such behaviors create a toxic culture that discourages other team members from participating in code reviews. It's crucial to understand that code reviews are a form of collaboration, and everyone shares a common goal. Therefore, the focus should be on improving code quality, adhering to code review best practices, and working together to achieve better software testing results.

Collaboration in Code Reviews

In the context of code reviews, it's vital not to take suggestions personally and equally important to defend your solution if you believe it's better than the proposed changes. Remember that the focus is on reviewing the code, not evaluating your abilities as a developer. Reviewers should approach the process with sensitivity, understanding that everyone benefits from the review. Code reviews are a constructive part of the code review process that aims to improve code quality, identify areas for enhancement, and ensure the successful integration of new code.

Building Stronger Teams Through Code Reviews

Code reviews foster an open process where developers can collaborate, share knowledge, and collectively enhance their solutions. Beyond its technical aspect, the review process also provides an opportunity for reviewers to acknowledge and appreciate the efforts of their peers when they encounter great code. These positive practices in code review contribute to building stronger and more confident teams, creating a supportive and encouraging environment for ongoing code management and software development.

Editors Note: This post was originally published on 20 February 2020, and was updated February 2024.

DVT AI GenAI Agent
DVT AI GenAI Agent