Exploring the Impact of Code Smells on Fine-Grained Structural Change-Proneness

Exploring the Impact of Code Smells on Fine-Grained Structural Change-Proneness
复制标题

探索代码异味对细粒度结构变更倾向的影响

DOI:
10.1142/s0218194018500432
复制
发表时间:
2018
影响因子:
0.9
通讯作者:
Jia Ru
Jia Ru
中科院分区:
计算机科学4区
文献类型:
--
作者:
Liu Huihui;Li Bixin;Yang Yibiao;Ma Wanwangying;Jia Ru

文献摘要

相似文献

代码气味是用来描述源代码中可能妨碍软件可维护性、可理解性和可更改性的不良结构。目前,学者们主要关注气味对语篇变化倾向的影响。然而,相对于语篇变化,结构变化更能揭示变化的本质。在实践中,并非所有代码更改类型在更改风险严重性级别方面都同样重要,软件开发人员对与其当前任务相关的特定更改更感兴趣。因此,我们研究气味和细粒度结构变化倾向之间的关系,以解决这些问题。我们的实验在11个典型的开源项目上进行。我们首先采用Fishers精确检验和Mann-Whitney检验来探索气味文件(受至少一种气味类型影响)是否比其他文件具有更高的结构变化倾向,以及具有更多气味实例的文件是否更有可能发生结构变化。建立多元Logistic回归模型,研究了五种变化类别中每种气味与变化倾向的关系。我们的研究结果表明:(1)在大多数情况下,有气味的文件更容易发生结构变化,并且气味实例越多的文件倾向于经历更高的结构变化;(2)相当多的气味类型与结构变化倾向相关,特别是拒绝父继承(RPB)、消息链(MCH)、分歧变化(DIVC)、特征嫉妒(FE)和猎枪手术(SS)增加了某些变化类别的结构变化。然而,当控制文件大小的代码行(行数)时,某些气味的显着变化倾向消失或显着程度或多或少地降低。
Code smells are used to describe the bad structures in the source code, which could hinder software maintainability, understandability and changeability. Nowadays, scholars mainly focus on the impact of smell on textual change-proneness. However, in comparison to textual changes, structural changes could better reveal the change nature. In practice, not all code change types are equally important in terms of change risk severity levels, and software developers are more interested in particular changes relevant to their current tasks. Therefore, we investigate the relationship between smells and fine-grained structural change-proneness to solve these issues. Our experiment was conducted on 11 typical open source projects. We first employed Fishers exact test and Mann–Whitney test to explore whether smelly files (affected by at least one smell type) had higher structural change-proneness than other files, and whether files with more smell instances are more likely to undergo structural changes, respectively. Multivariate logistic regression model was built to study the relation between each kind of smell and change-proneness with respect to five change categories. Our results showed that: (1) in most cases, smelly files were more prone to structural changes and files with more smell instances tend to undergo higher structural changes; (2) quite a few smell types were related to structural change-proneness, particularly, Refused Parent Bequest (RPB), Message Chains (MCH), Divergent Change (DIVC), Feature Envy (FE) and Shotgun Surgery (SS) increased structural changes for some change categories. However, when controlling the file size Lines of Code (LOC), significant change-proneness of some smells disappeared or the magnitude of significance decreased more or less.