论文标题

人群:在代码气味检测中使用集体知识

Crowdsmelling: The use of collective knowledge in code smells detection

论文作者

Reis, José Pereira dos, Abreu, Fernando Brito e, Carneiro, Glauco de Figueiredo

论文摘要

代码气味被视为技术债务的主要来源,因此应检测和去除。但是,研究人员认为,代码气味检测过程的主观性是减轻气味代码问题的主要障碍。我们提出了基于监督的机器学习技术的人群方法,其中使用(软件开发人员)的智慧来集体校准代码气味检测算法,从而减少了主观性问题。本文介绍了人群方法的验证实验的结果。在连续三年的软件工程课程的背景下,总计约一百支团队的“人群”,平均每个成员平均为Java源代码中的3种代码气味(长方法,上帝班级和嫉妒)分类。这些分类是用于训练六种机器学习算法的甲壳的基础。生成和评估了一百多个模型,以确定哪种机器学习算法在检测上述代码气味时具有最佳性能。对于上帝的阶级检测,获得了良好的表现(ROC = 0.896,幼稚的贝叶斯)和较长的方法检测(roc = 0.870,对于adaboostm1),但特征嫉妒(随机forrest的ROC = 0.570)要低得多。获得的结果表明,人群是检测代码气味的一种可行方法,但是需要进一步的验证实验才能覆盖更多的代码气味并提高外部有效性。

Code smells are seen as major source of technical debt and, as such, should be detected and removed. However, researchers argue that the subjectiveness of the code smells detection process is a major hindrance to mitigate the problem of smells-infected code. We proposed the crowdsmelling approach based on supervised machine learning techniques, where the wisdom of the crowd (of software developers) is used to collectively calibrate code smells detection algorithms, thereby lessening the subjectivity issue. This paper presents the results of a validation experiment for the crowdsmelling approach. In the context of three consecutive years of a Software Engineering course, a total "crowd" of around a hundred teams, with an average of three members each, classified the presence of 3 code smells (Long Method, God Class, and Feature Envy) in Java source code. These classifications were the basis of the oracles used for training six machine learning algorithms. Over one hundred models were generated and evaluated to determine which machine learning algorithms had the best performance in detecting each of the aforementioned code smells. Good performances were obtained for God Class detection (ROC=0.896 for Naive Bayes) and Long Method detection (ROC=0.870 for AdaBoostM1), but much lower for Feature Envy (ROC=0.570 for Random Forrest). Obtained results suggest that crowdsmelling is a feasible approach for the detection of code smells, but further validation experiments are required to cover more code smells and to increase external validity.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源