When the content is as abstract as it is here, you need special strategies to locate mistakes. | Image: iStockphoto

New lines of code have to be proofread when they’re integrated into software. This so-called ‘code review’ process is mentally challenging, time- and cost-intensive, because code reviewers often have to grapple with several hundred lines of the programming language. A study by the University of Zurich now shows that checklists can make this search for errors more efficient.

“In software engineering research and practice, checklists are considered a way to reduce cognitive load to find defects in the code”, says the industrial psychologist Pavlína Wurzel Gonçalves. “This had not yet been scientifically proven”. ‘Cognitive load’ denotes how intensively our working memory is being used. It depends on the complexity of the task at hand, the level of skill required and how information is presented. If the maximum capacity of our working memory is exceeded, the quality of the code review decreases.

“In a complex task, the guided checklist does not increase efficiency because it limits the individual approach”.Pavlína Wurzel Gonçalves

Wurzel Gonçalves’s study investigated how certain tools can help to reduce cognitive load. She asked 70 participants to solve both simple and complex code review tasks, and gave them either a guided checklist, a simple checklist, or no tools at all. She and her team found that inexperienced reviewers located more errors in simple code with the help of a systematic checklist that can guide them step by step through what to check, where, and when.

“However, in a complex task, the guided checklist does not increase efficiency because it limits the individual approach”, says Wurzel Gonçalves. “If reviewers can navigate the code themselves using a simple checklist, it leads to better results when reviewing complex changes in the code”. Since her participants were inexperienced in undertaking code reviews, further studies are intended to clarify which tools can help code-review experts. To be sure, no tool exists that’s suitable for all cases. “Depending on the complexity of the code, a different tool is suitable”.

P. Wurzel Gonçalves et al.: Do explicit review strategies improve code review performance? Towards understanding the role of cognitive load. Empirical Software Engineering (2022)