Effects of Modularization on Developers' Cognitive Effort in Code Comprehension Tasks: A Controlled Experiment

  • Matheus Segalotto UNISINOS
  • Willian Bolzan IFSC
  • Kleinner Farias UNISINOS


Developers invest the cognitive effort to comprehend instructions in source code. Cognitive effort refers to the cognitive processing of a human being’s brain required to complete a cognitive task. The cognitive effort invested by developers can vary depending on the complexity of how instructions in source code are structured. To implement features, developers can write all instructions in a single method (non-modular) or even modularize it into several methods (modular). However, little is known about the effects of modularizing instructions in source code on the developers’ cognitive effort. Hence, adopting modularization practices ends up being a cognitive effort-insensitive task. This paper, therefore, reports on a controlled experiment that investigates the effects of modularization on the cognitive effort of developers while comprehending instructions in (non-)modular code. We evaluated the modularization of instructions with the participation of 35 developers who performed 10 comprehension tasks using a wearable EEG device. The main results suggest that developers tend to invest less cognitive effort to understand instructions in modular code rather than in non-modular code. However, developers spend more temporal effort to understand instructions in modular code, and this extra time is not converted into a higher rate of correct code comprehension. Our findings shed light on improving the state of the art of modularization practices by making them sensitive to the developers’cognitive effort.

Palavras-chave: Modularization, EEG, Cognitive Effort, Code Comprehension
SEGALOTTO, Matheus; BOLZAN, Willian; FARIAS, Kleinner. Effects of Modularization on Developers' Cognitive Effort in Code Comprehension Tasks: A Controlled Experiment. In: SIMPÓSIO BRASILEIRO DE ENGENHARIA DE SOFTWARE (SBES), 37. , 2023, Campo Grande/MS. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2023 . p. 206–215.