X-SBR: On the Use of the History of Refactorings for Explainable Search-Based Refactoring and Intelligent Change Operators

Abstract

Refactoring is widely adopted nowadays in the industry to restructure the code and meet high quality while preserving the external behavior. Many of the existing refactoring tools and research are based on search-based techniques to find relevant recommendations by finding trade-offs between different quality attributes. While these techniques show promising results on open-source and industry projects, they lack explanations of the recommended changes which can impact their trustworthiness when adopted in practice by developers. Furthermore, most of the adopted search-based techniques are based on random population generation and random change operators (e.g. crossover and mutation). However, it is critical to understand which good refactoring patterns may exist when applying change operators to either keep or exchange them with other solutions rather than destroying them with random changes. In this paper, we propose an enhanced knowledge-informed multi-objective search algorithm, called X-SBR, to provide explanations for refactoring solutions and improve the generated recommendations. First, we generate association rules using the Apriori algorithm to find relationships between applied refactorings in previous commits, their locations, and their rationale (quality improvements). Then, we use these rules to 1) initialize the population, 2) improve the change operators and seeding mechanisms of the multi-objective search in order to preserve and exchange good patterns in the refactoring solutions, and 3) explain how a sequence of refactorings collaborate in order to improve the quality of the system (e.g. fitness functions). The validation on large open-source systems shows that X-SBR provides refactoring solutions of better quality than those given by the state-of-the-art techniques in terms of reducing the invalid refactorings, improving the quality, and increasing the trustworthiness of the developers in the suggested refactorings via the provided explanations.

Publication
In IEEE Transactions on Software Engineering
Chaima Abid
Dhia Elhaq Rzig
Dhia Elhaq Rzig
Ph.D. Candidate in Computer and Information Science

My research interests include DevOps, Continuous Integration, Machine Learning, Testing and Virtual Reality.

Thiago Ferreira
Marouane Kessentini
Tushar Sharma