arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2010.13890cs.SEcs.LG
收藏

我们如何重构以及如何记录它?使用监督机器学习算法对重构文档进行分类

How We Refactor and How We Document it? On the Use of Supervised Machine Learning Algorithms to Classify Refactoring Documentation

Rochester Institute of Technology(罗切斯特理工学院);ETS Montreal, University of Quebec(魁北克大学蒙特利尔分校);University of Michigan(密歇根大学)

Eman Abdullah AlOmar, Anthony Peruma, Mohamed Wiem Mkaouer, Christian Newman, Ali Ouni, Marouane Kessentini

摘要:

重构是一种在不改变系统外部行为的情况下改进系统设计的艺术。重构已经成为一个完善的和有纪律的软件工程实践,已经吸引了大量的研究假设重构的主要动机是需要改善系统结构。然而,最近的研究表明,开发人员可能会将重构纳入其他开发活动中,而不仅仅是改进设计。不幸的是,这些研究仅限于开发人员访谈和一组减少的项目。为了克服上述限制,我们的目标是通过挖掘和分类从800个Java项目中提取的111,884个包含重构的提交来更好地理解是什么促使开发人员应用重构。我们训练了一个多类分类器,将这些提交分为3个类别,即内部QA,外部QA和代码验证解决方案,以及传统的BugFix和Functional类别。这种分类挑战了重构的原始定义,它专门用于改进设计和修复代码气味。此外,为了更好地理解我们的分类结果,我们分析了提交消息,以提取开发人员经常用来描述其重构的文本模式。结果表明:(1)修复代码气味不是开发人员重构代码库的主要驱动力。请求重构的原因有很多,超出了它的传统定义;(2)重构的分布在生产和测试文件之间不同;(3)开发人员使用几种模式来有目的地针对重构;(4)从提交消息中提取的文本模式为开发人员如何记录他们的重构提供了更好的覆盖。

英文摘要:

Refactoring is the art of improving the design of a system without altering its external behavior. Refactoring has become a well established and disciplined software engineering practice that has attracted a significant amount of research presuming that refactoring is primarily motivated by the need to improve system structures. However, recent studies have shown that developers may incorporate refactorings in other development activities that go beyond improving the design. Unfortunately, these studies are limited to developer interviews and a reduced set of projects. To cope with the above-mentioned limitations, we aim to better understand what motivates developers to apply refactoring by mining and classifying a large set of 111,884 commits containing refactorings, extracted from 800 Java projects. We trained a multi-class classifier to categorize these commits into 3 categories, namely, Internal QA, External QA, and Code Smell Resolution, along with the traditional BugFix and Functional categories. This classification challenges the original definition of refactoring, being exclusive to improving the design and fixing code smells. Further, to better understand our classification results, we analyzed commit messages to extract textual patterns that developers regularly use to describe their refactorings. The results show that (1) fixing code smells is not the main driver for developers to refactoring their codebases. Refactoring is solicited for a wide variety of reasons, going beyond its traditional definition; (2) the distribution of refactorings differs between production and test files; (3) developers use several patterns to purposefully target refactoring; (4) the textual patterns, extracted from commit messages, provide better coverage for how developers document their refactorings.

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

↑