论文标题
rmove:建议使用代码的结构和语义表示重构机会进行重构机会
RMove: Recommending Move Method Refactoring Opportunities using Structural and Semantic Representations of Code
论文作者
论文摘要
在类中,方法不正确的位置是一种典型的代码气味,称为“特征嫉妒”,这会导致进化过程中的额外维护和成本。为了删除此设计缺陷,已经提出了几种移动方法重构工具。据我们所知,与最先进的技术相关的技术可以广泛分为两类:第一行是基于软件测量的非基于学习的方法,而软件指标的选择和阈值在很大程度上依赖于专家知识。第二行是基于机器学习的方法,它建议通过学习从代码信息中提取功能来重构进行重构。但是,此行中的大多数方法都对不同形式的代码信息进行了相同的处理,从而无视它们在数据分析上的显着差异。在本文中,我们提出了一种建议,通过分别从代码片段中自动学习结构和语义表示,建议移动方法重构rmove。我们将这些表示形式加在一起,并进一步训练机器学习分类器,以指导方法向合适的课程移动。我们在两个公开可用的数据集上评估了我们的方法。结果表明,我们的方法优于三种最先进的重构工具,包括PathMove,Jdeodorant和Jmove的有效性和实用性。结果还揭示了有用的发现,并提供了新的见解,从而使其他类型的特征嫉妒的重构技术受益。
Incorrect placement of methods within classes is a typical code smell called Feature Envy, which causes additional maintenance and cost during evolution. To remove this design flaw, several Move Method refactoring tools have been proposed. To the best of our knowledge, state-of-the-art related techniques can be broadly divided into two categories: the first line is non-machine-learning-based approaches built on software measurement, while the selection and thresholds of software metrics heavily rely on expert knowledge. The second line is machine learning-based approaches, which suggest Move Method refactoring by learning to extract features from code information. However, most approaches in this line treat different forms of code information identically, disregarding their significant variation on data analysis. In this paper, we propose an approach to recommend Move Method refactoring named RMove by automatically learning structural and semantic representation from code fragment respectively. We concatenate these representations together and further train the machine learning classifiers to guide the movement of method to suitable classes. We evaluate our approach on two publicly available datasets. The results show that our approach outperforms three state-of-the-art refactoring tools including PathMove, JDeodorant, and JMove in effectiveness and usefulness. The results also unveil useful findings and provide new insights that benefit other types of feature envy refactoring techniques.