arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2009.02438cs.SE
收藏

Spaghetti代码和Blob反模式对程序理解影响的大规模实证研究

A Large Scale Empirical Study of the Impact of Spaghetti Code and Blob Anti-patterns on Program Comprehension

Cristiano Politowski, Foutse Khomh, Simone Romano, Giuseppe Scanniello, Fabio Petrillo, Yann-Gaël Guéhéneuc, Abdou Maiga

摘要:

上下文:几项研究调查了反模式的影响(即,在维护活动期间,经常出现的设计问题的“糟糕”解决方案),并报告说反模式严重影响了开发人员编辑文件所需的工作。但是,在开发人员编辑文件之前,他们必须了解系统的源代码。这些源代码必须易于开发人员理解。目的:在这项工作中,我们提供了一个完整的评估两个实例的两个反模式,斑点或意大利面条代码,对程序的理解的影响。方法:我们通过在蒙特利尔理工学院(加拿大)进行的三项实证研究分析了这两种反模式的影响,有24名参与者;在卡尔顿大学(加拿大)有30名参与者;在巴西利卡塔大学(意大利)有79名参与者。结果:我们收集了来自三所大学的133名不同参与者的372项任务的数据。我们使用三个指标来评估开发人员对源代码的理解:(1)完成每个任务的持续时间;(2)正确答案的百分比;(3)NASA任务负荷指数。结论:我们报告说,虽然单次出现的Blob或Spaghetti代码反模式对代码理解的影响不大,两次出现的Blob或Spaghetti代码显着增加了开发人员的时间花在他们的任务,减少他们的正确答案的百分比,并增加他们的努力。因此,我们建议开发人员对这两种反模式都采取行动,只要有可能,就应该从源代码中重构出来。我们还建议进一步研究反模式的组合,而不是一次一个地研究单个反模式。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑