论文标题
大规模的实证研究意大利面条代码和斑点反图案对程序理解的影响
A Large Scale Empirical Study of the Impact of Spaghetti Code and Blob Anti-patterns on Program Comprehension
论文作者
论文摘要
背景:几项研究调查了在维护活动期间,反pates(即“差”解决方案对重复设计问题)的影响,并报告说,反模式显着影响开发人员编辑文件所需的努力。但是,在开发人员编辑文件之前,他们必须了解系统的源代码。开发人员必须易于理解此源代码。目的:在这项工作中,我们提供了两个反图案,BLOB或意大利面代码对程序理解的两个实例的影响。方法:我们通过在加拿大理工学院(PolytechniqueMontréal)(加拿大)与24名参与者进行的三项经验研究分析了这两种反图案的影响;在加拿大卡尔顿大学(Carlton University),有30名参与者;在意大利大学(意大利)有79名参与者。结果:我们从三所大学的133名参与者中收集了372个任务中的数据。我们使用三个指标来评估开发人员对源代码的理解:(1)完成每个任务的持续时间; (2)他们正确答案的百分比; (3)NASA任务负载指数的努力。结论:我们报告,尽管斑点或意大利面条代码反模式的单一事件对代码理解的影响很小,但两次BLOB或意大利面代码的出现大大增加了开发人员在任务上所花费的时间,减少其正确答案的百分比,并增加了他们的精力。因此,我们建议开发人员对这两个反pation派作用,应尽可能从源代码中重构。我们还建议进一步研究抗模式的组合,而不是一次对单个反模式的组合。
Context: Several studies investigated the impact of anti-patterns (i.e., "poor" solutions to recurring design problems) during maintenance activities and reported that anti-patterns significantly affect the developers' effort required to edit files. However, before developers edit files, they must understand the source code of the systems. This source code must be easy to understand by developers. Objective: In this work, we provide a complete assessment of the impact of two instances of two anti-patterns, Blob or Spaghetti Code, on program comprehension. Method: We analyze the impact of these two anti-patterns through three empirical studies conducted at Polytechnique Montréal (Canada) with 24 participants; at Carlton University (Canada) with 30 participants; and at University Basilicata (Italy) with 79 participants. Results: We collect data from 372 tasks obtained thanks to 133 different participants from the three universities. We use three metrics to assess the developers' comprehension of the source code: (1) the duration to complete each task; (2) their percentage of correct answers; and, (3) the NASA task load index for their effort. Conclusions: We report that, although single occurrences of Blob or Spaghetti code anti-patterns have little effect on code comprehension, two occurrences of either Blob or Spaghetti Code significantly increases the developers' time spent in their tasks, reduce their percentage of correct answers, and increase their effort. Hence, we recommend that developers act on both anti-patterns, which should be refactored out of the source code whenever possible. We also recommend further studies on combinations of anti-patterns rather than on single anti-patterns one at a time.