arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2103.01861cs.SEcs.LG
收藏

跟随你的嗅觉——哪些代码异味值得追踪?

Follow Your Nose -- Which Code Smells are Worth Chasing?

The Hebrew University(希伯来大学)

Idan Amit, Nili Ben Ezra, Dror G. Feitelson

AI总结:

本文实证研究了代码异味与代码质量的因果关系,通过分析677个GitHub仓库中31,687个Java文件,发现CheckStyle检测的151种异味中不到20%具有潜在因果性,开发者往往移除容易而非有效的异味。

摘要:

代码异味的常见用例假设存在因果关系:识别一种异味,将其移除,并借此改进代码。我们实证研究了它们是否适合这一用例。我们提出了一份代码异味若确实导致较低质量所应具备的属性清单。我们评估了来自677个GitHub仓库的31,687个Java文件中的异味,这些仓库均为2019年提交次数超过200次的仓库。我们测量了异味对质量、生产率和缺陷检测效率四个指标的影响。在CheckStyle异味检测器计算出的151种代码异味中,不到20%被发现具有潜在因果性,且只有少数几种相当稳健。最强的异味涉及简洁性、防御式编程和抽象。不含潜在因果性异味的文件有50%更高的可能性属于高质量。不幸的是,大多数异味并未被移除,开发者倾向于移除容易处理的异味,而非有效的异味。

英文摘要:

The common use case of code smells assumes causality: Identify a smell, remove it, and by doing so improve the code. We empirically investigate their fitness to this use. We present a list of properties that code smells should have if they indeed cause lower quality. We evaluated the smells in 31,687 Java files from 677 GitHub repositories, all the repositories with 200+ commits in 2019. We measured the influence of smells on four metrics for quality, productivity, and bug detection efficiency. Out of 151 code smells computed by the CheckStyle smell detector, less than 20% were found to be potentially causal, and only a handful are rather robust. The strongest smells deal with simplicity, defensive programming, and abstraction. Files without the potentially causal smells are 50% more likely to be of high quality. Unfortunately, most smells are not removed, and developers tend to remove the easy ones and not the effective ones.

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

↑