Effects of Modularization on Developers' Cognitive Effort in Code Comprehension Tasks: A Controlled Experiment - Segalotto, Matheus; Bolzan, Willian; Farias, Kleinner (Anais do Simpósio Brasileiro de Engenharia de Software (SBES); 2023: Anais do XXXVII Simpósio Brasileiro de Engenharia de Software, 2023)
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.