Generation of refactoring algorithms by grammatical evolution

Generation of refactoring algorithms by grammatical evolution
复制标题

DOI:
10.1007/s10664-022-10151-4
复制
发表时间:
2022-05
影响因子:
4.1
通讯作者:
Thainá Mariani;Marouane Kessentini;S. Vergilio
Thainá Mariani;Marouane Kessentini;S. Vergilio
中科院分区:
计算机科学2区
文献类型:
--
作者:
Thainá Mariani;Marouane Kessentini;S. Vergilio

文献摘要

相似文献

最近的机器学习研究提供了生成预测模型的准确结果,以识别程序的重构操作。然而,这样的工作仅限于预测,也就是说,他们严格按照开发人员的应用学习重构操作,但存在他们可能不会想到的可能性。另一方面,基于搜索的软件重构(Search-Based Software Refactoring,SBR)领域应用搜索算法在广阔的可能性空间中发现重构操作,以改进不同的质量属性。然而,现有的SBR方法并不像机器学习研究那样生成模型,然后,它们需要针对每个需要重构的程序单独重新应用。为了缓解这一限制,该工作引入了一种新颖的SBR学习方法,该方法生成能够为多个程序提供重构操作的重构算法。这些算法由使用规则来确定重构操作的过程组成。为了创建算法,学习过程首先从程序中提取重构模式,方法是对以类似方式重构的元素进行分组。之后,基于包含所提取的模式的细节的语法,应用语法进化(GE)来生成算法。GE致力于生成一种算法,该算法提供与实践中应用的重构操作类似的重构操作,同时改进质量属性,如模块化。使用来自GitHub知识库的40个Java程序的重构数据对该方法进行了评估。算法针对不同的程序进行了测试,获得了60%的模块化改进和50%的与实际重构操作的相似性。
Recent machine learning studies present accurate results generating prediction models to identify refactoring operations for a program. However, such works are limited to prediction, i.e., they learn refactoring operations strictly as applied by developers, but there are possibilities that they might not think. On the other hand, theSearch-Based Software Refactoring (SBR)field applies search algorithms to find refactoring operations in a vast space of possibilities to improve diverse quality attributes. Nevertheless, existing SBR approaches do not generate a model as machine learning studies, and then, they need to be reapplied individually for each program needing refactoring. To mitigate this limitation, this work introduces a novel SBR learning approach that generates refactoring algorithms capable of providing refactoring operations to several programs. These algorithms are composed of procedures that use rules to determine the refactoring operations. To create the algorithms, a learning process first extracts refactoring patterns from programs by grouping their elements that were refactored in similar ways. After that, aGrammatical Evolution (GE)is applied to generate the algorithms based on a grammar encompassing details of the extracted patterns. GE works to generate an algorithm that provides refactoring operations similar to those applied in practice while improving quality attributes, such as modularity. The approach is evaluated using refactoring data from 40 Java programs of GitHub repositories. The algorithms are tested against different programs, obtaining an overall average of 60% of modularity improvement and 50% of similarity with actual refactoring operations.