Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

Optional: Explanation of code review activity

The code review process can be an eye-opening experience. It shows how important it is to thoroughly examine code for potential issues.
If you attempted the optional exercise in the last step, here is a summary of the coding issues we identified:

  1. Logical error: The original formula for calculating the area of the rectangle was incorrect (multiplying by 0.5). The correct formula should be “length * width”.
  2. Naming conventions: The function name should follow camelCase convention (i.e. “calculateArea” instead of “Calculate_Area”).
  3. Comments: We added more descriptive comments to improve the readability and understanding of the code.
  4. Inefficient algorithms: No issues found. The algorithm for calculating the area of a rectangle is efficient.
  5. Edge cases: The code didn’t handle cases where the length or width is equal to 0. We updated the condition to check for non-positive values (“length <= 0 OR width <= 0”).

Why code reviews matter

The code review process can be an eye-opening experience. It shows how important it is to thoroughly examine code for potential issues. Even simple code can have errors that may not be immediately obvious. We also saw that paying attention to details like naming conventions and proper commenting is crucial for creating clean, maintainable code.

One challenge we faced during the code review was identifying the logical error. It can take some time to realise that the formula was incorrect.

Overall, the code review process helps us understand the importance of static testing techniques in identifying issues early in the software development process.

This article is from the free online

Foundations of Software Testing and Validation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now