-->

Tuesday, February 20, 2018

Code review is systematic examination (sometimes referred to as peer review) of computer source code. It is intended to find mistakes overlooked in software development, improving the overall quality of software. Reviews are done in various forms such as pair programming, informal walkthroughs, and formal inspections.

Introduction




Code Review Best Practices - Learn Spring Boot with a 100 page PDF Course Guide. Bonus - 10 Awesome Getting Started Videos - https://courses.in28minutes.com/p/spring-boot-for-beginners-in-10-steps Find out more about...

Simple Definition

A code review is a process where two or more developers visually inspect a set of program code, typically, several times. The code can be a method, a class, or an entire program. The main code-review objectives are:

  1. Best Practice ~ A more efficient, less error-prone, or more elegant way to accomplish a given task.
  2. Error Detection ~ Discovering logical or transitional errors.
  3. Vulnerability Exposure ~ Identifying and averting common vulnerabilities like Cross-Site Scripting [XSS], Injection, Buffer Overflow, Excessive Disclosure, etc. Although many controls are inapplicable and can be ignored, a STIG [e.g., Application Security STIG 4.3] provides an excellent vulnerability checklist.
  4. Malware Discovery ~ This often-overlooked and very special code-review objective looks for segments of code that appear extraneous, questionable, or flat-out weird. The intent is to discover back doors, Trojans, and time bombs. In today’s world malevolent code is a very real threat and should not be overlooked, especially by Government agencies

Artifacts

The most important byproduct of a properly conducted code review is a written record describing:

  • Who ~ Names of those involved in the Review.
  • When ~ Date and time the Review was conducted.
  • Why ~ Best-Practice, Error Detection, Vulnerability Exposure, Malware Discovery or a combination.
  • Where ~ Office number or other location identifier.
  • What ~ Name of the class, method, or program, plus line ranges and other particulars specific to the reviewed code.
  • Result ~ What was disclosed during the course of the Review.

Details

Code reviews can often find and remove common vulnerabilities such as format string exploits, race conditions, memory leaks and buffer overflows, thereby improving software security. Online software repositories based on Subversion (with Redmine or Trac), Mercurial, Git or others allow groups of individuals to collaboratively review code. Additionally, specific tools for collaborative code review can facilitate the code review process.

Automated code reviewing software lessens the task of reviewing large chunks of code on the developer by systematically checking source code for known vulnerabilities. A 2012 study by VDC Research reports that 17.6% of the embedded software engineers surveyed currently use automated tools for peer code review and 23.7% expect to use them within 2 years.

Capers Jones' ongoing analysis of over 12,000 software development projects showed that the latent defect discovery rate of formal inspection is in the 60-65% range. For informal inspection, the figure is less than 50%. The latent defect discovery rate for most forms of testing is about 30%.

Code review rates should be between 200 and 400 lines of code per hour. Inspecting and reviewing more than a few hundred lines of code per hour for critical software (such as safety critical embedded software) may be too fast to find errors. Industry data indicates that code reviews can accomplish at most an 85% defect removal rate with an average rate of about 65%.

The types of defects detected in code reviews have also been studied. Empirical studies provided evidence that up to 75% of code review defects affect software evolvability rather than functionality, making code reviews an excellent tool for software companies with long product or system life cycles.

Types


Automated Code Review Tools for Security
Automated Code Review Tools for Security. Source : mycomputer.computer.org

Code review practices fall into two main categories: formal code review and lightweight code review.

Formal code review, such as a Fagan inspection, involves a careful and detailed process with multiple participants and multiple phases. Formal code reviews are the traditional method of review, in which software developers attend a series of meetings and review code line by line, usually using printed copies of the material. Formal inspections are extremely thorough and have been proven effective at finding defects in the code under review.

Lightweight code review typically requires less overhead than formal code inspections. Lightweight reviews are often conducted as part of the normal development process:

  • Over-the-shoulder â€" one developer looks over the author's shoulder as the latter walks through the code.
  • Email pass-around â€" source code management system emails code to reviewers automatically after checkin is made.
  • Pair programming â€" two authors develop code together at the same workstation, as is common in Extreme Programming.
  • Tool-assisted code review â€" authors and reviewers use software tools, informal ones such as pastebins and IRC, or specialized tools designed for peer code review.

Some of these are also known as walkthrough (informal) or "critique" (fast and informal) code review types.

Many teams that eschew traditional, formal code review use one of the above forms of lightweight review as part of their normal development process. A code review case study published in the book Best Kept Secrets of Peer Code Review found that lightweight reviews uncovered as many bugs as formal reviews, but were faster and more cost-effective in contradiction to the study done by Capers Jones

Criticism


Informatica powercenter code quality checker
Informatica powercenter code quality checker. Source : marketplace.informatica.com

Historically, formal code reviews have required a considerable investment in preparation for the review event and execution time. Use of code analysis tools can support this activity. Especially tools that work in the IDE as they provide direct feedback to developers of coding standard compliance.

See also


5 Best Practices For Expert Source Code Review In A Patent Case ...
5 Best Practices For Expert Source Code Review In A Patent Case .... Source : eurekasoft.com

References


Yet Another Code Review Best Practices - Technical Blog - Future ...
Yet Another Code Review Best Practices - Technical Blog - Future .... Source : www.future-processing.pl

External links


Best practices for effective code reviews
Best practices for effective code reviews. Source : willowtreeapps.com

  • "A Guide to Code Inspections" (Jack G. Ganssle)
  • Article Four Ways to a Practical Code Review
  • Code Review - Write your code right
  • Code Reviews: Just Do It
  • Benefits of Code Reviews

11 Best Practices for Peer Code Review | Software Bug | Software ...
11 Best Practices for Peer Code Review | Software Bug | Software .... Source : www.scribd.com

 
Sponsored Links