da Costa José Aldo Silva, Gheyi Rohit, Ribeiro Márcio, Apel Sven, Alves Vander, Fonseca Baldoino, Medeiros Flávio, Garcia Alessandro
Federal University of Campina Grande, Campina Grande, Brazil.
Federal University of Alagoas, Maceió, Brazil.
Empir Softw Eng. 2021;26(5):92. doi: 10.1007/s10664-021-10002-8. Epub 2021 Jul 7.
The C preprocessor is widely used in practice. Conditional compilation with #ifdef annotations allows developers to flexibly introduce variability in their programs. Developers can use disciplined annotations, entirely enclosing full statements with preprocessor directives, or undisciplined ones, enclosing only parts of the statements. Despite some debate, there is no consensus on whether a developer should use exclusively disciplined annotations. While one prior study found undisciplined annotations more time-consuming and error-prone, another study found no difference between disciplined and undisciplined annotations regarding task completion time and accuracy. In this article, we evaluate whether three fine-grained refactorings to discipline #ifdef annotations correlate with improvements in code comprehension and visual effort with an eye tracker. We conduct a controlled experiment with 64 human subjects who were majoritarily novices in the C programming language. We observed statistically significant differences for two refactorings to discipline annotations with respect to the analyzed metrics (time, fixation duration, fixation count, and regressions count) in the code regions changed by each refactoring.
C预处理器在实践中被广泛使用。使用#ifdef注释进行条件编译使开发人员能够在程序中灵活地引入变化。开发人员可以使用规范的注释,即用预处理器指令完全包围完整的语句,也可以使用不规范的注释,即只包围语句的部分内容。尽管存在一些争议,但对于开发人员是否应该只使用规范的注释并没有达成共识。虽然之前的一项研究发现不规范的注释更耗时且容易出错,但另一项研究发现规范注释和不规范注释在任务完成时间和准确性方面没有差异。在本文中,我们使用眼动仪评估对#ifdef注释进行的三种细粒度重构是否与代码理解和视觉工作量的改进相关。我们对64名主要是C编程语言新手的受试者进行了一项对照实验。在每个重构所改变的代码区域中,我们观察到两种用于规范注释的重构在分析指标(时间、注视持续时间、注视次数和回退次数)方面存在统计学上的显著差异。