Some Code Smells Have a Significant but Small Effect on Faults

Some Code Smells Have a Significant but Small Effect on Faults
复制标题

DOI:
10.1145/2629648
复制
发表时间:
2014-08-01
影响因子:
4.4
通讯作者:
Sun, Yi
Sun, Yi
中科院分区:
计算机科学1区
文献类型:
--
作者:
Hall, Tracy;Zhang, Min;Sun, Yi

文献摘要

被引文献

相似文献

我们研究了故障与Fowler等人的五个中的关系之间的关系:数据集团,开关语句,投机性通用性,消息链和中间人之间的关系。我们开发了一种工具来检测三种开源系统中的这五种气味:Eclipse,Argouml和Apache Commons。我们从每个系统的更改和故障存储库中收集了故障数据。我们建立了负二项式回归模型,以分析气味与故障之间的关系,并报告这些关系的麦法登效应大小。我们的结果表明,开关语句对这三个系统中的任何一个中的任何一个都没有影响。消息链在两个系统中增加了故障。在较大文件中发生的消息链减少了故障;数据团块减少了Apache和Eclipse中的故障,但增加了Argouml的故障。中间人仅在Argouml中减少了断层,而投机性的一般性仅在Eclipse中降低了断层。仅文件大小就会影响某些系统中的故障,但在所有系统中都不会影响故障。气味确实会显着影响断层,该效果的大小很小(始终低于10%)。我们的发现表明,在某些情况下,某些气味确实表明易于故障的代码,但是这些气味对故障的影响很小。我们的发现还表明,气味对不同系统的影响不同。我们得出的结论是,任意重构不太可能显着降低缺陷主持性,在某些情况下可能会增加缺陷主持性。
We investigate the relationship between faults and five of Fowler et al.'s least-studied smells in code: Data Clumps, Switch Statements, Speculative Generality, Message Chains, and Middle Man. We developed a tool to detect these five smells in three open-source systems: Eclipse, ArgoUML, and Apache Commons. We collected fault data from the change and fault repositories of each system. We built Negative Binomial regression models to analyse the relationships between smells and faults and report the McFadden effect size of those relationships. Our results suggest that Switch Statements had no effect on faults in any of the three systems; Message Chains increased faults in two systems; Message Chains which occurred in larger files reduced faults; Data Clumps reduced faults in Apache and Eclipse but increased faults in ArgoUML; Middle Man reduced faults only in ArgoUML, and Speculative Generality reduced faults only in Eclipse. File size alone affects faults in some systems but not in all systems. Where smells did significantly affect faults, the size of that effect was small (always under 10 percent). Our findings suggest that some smells do indicate fault-prone code in some circumstances but that the effect that these smells have on faults is small. Our findings also show that smells have different effects on different systems. We conclude that arbitrary refactoring is unlikely to significantly reduce fault-proneness and in some cases may increase fault-proneness.