On the Employment of Machine Learning for Recommending Refactorings: A Systematic Literature Review

  • Guisella Angulo Armijo UFSCar
  • Daniel San Martín Santibañez UCN
  • Rafael Durelli UFLA
  • Valter Vieira de Camargo UFSCar

Resumo


Context and Motivation: Refactoring is a widely recognized technique aimed at enhancing the comprehensibility and maintainability of source code while preserving its external behavior. The widespread adoption of refactorings as a systematic practice is still very dependent on individual expertise and inclination of software engineers. To address this challenge, various approaches have emerged with the objective of automatically suggesting refactorings, thereby alleviating engineers from the manual burden of identifying such opportunities. Objective: This study aims to analyze the current landscape of approaches utilizing Machine Learning (ML) for recommending refactorings and discuss their usage. Method: A Systematic Literature Review (SLR) was conducted, spanning five scientific databases from 2015 to December 2023. Initially, 177 papers were identified, from which a final set of 27 papers was reached. Results: The findings encompass: i) an exploration of the most and least investigated refactorings and ML techniques; ii) an analysis of the datasets used; iii) an examination of the evaluation methodologies employed; and iv) an assessment of recommendation completeness and quality. Conclusion: This study has significant potential for further research, as numerous refactorings remain unexplored by existing studies. Furthermore, it highlights that many ML-based approaches fall short in delivering comprehensive recommendations, thus emphasizing the imperative for ongoing investigation and enhancement in this field. All artifacts produced from our research are available on the replication package [1].
Palavras-chave: refactoring recommendation, machine learning

Referências

2024. On the Employment of Machine Learning for Recommending Refactorings: A Systematic Literature Review. Zenodo.

Chaima Abid, Vahid Alizadeh, Marouane Kessentini, Thiago do Nascimento Ferreira, and Danny Dig. 2020. 30 years of software refactoring research: a systematic literature review. arXiv preprint arXiv:2007.02194 (2020).

Ahmed Al-Shaaby, Hamoud Aljamaan, and Mohammad Alshayeb. 2020. Bad smell detection using machine learning techniques: a systematic literature review. Arabian Journal for Science and Engineering 45, 4 (2020), 2341–2369.

Mamdouh Alenezi, Mohammed Akour, and Osama Al Qasem. 2020. Harnessing deep learning algorithms to predict software refactoring. Telkomnika 18, 6 (2020), 2977–2982.

Vahid Alizadeh, Houcem Fehri, and Marouane Kessentini. 2019. Less is More: From Multi-objective to Mono-objective Refactoring via Developer’s Knowledge Extraction. In 2019 19th International Working Conference on Source Code Analysis and Manipulation (SCAM). IEEE, 181–192.

Vahid Alizadeh and Marouane Kessentini. 2018. Reducing interactive refactoring effort via clustering-based multi-objective search. In 2018 33rd IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 464–474.

Vahid Alizadeh, Mohamed Amine Ouali, Marouane Kessentini, and Meriem Chater. 2019. RefBot: Intelligent software refactoring bot. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 823–834.

Eman Abdullah AlOmar, Anton Ivanov, Zarina Kurbatova, Yaroslav Golubev, Mohamed Wiem Mkaouer, Ali Ouni, Timofey Bryksin, Le Nguyen, Amit Kini, and Aditya Thakur. 2023. Just-in-time code duplicates extraction. Information and Software Technology 158 (2023), 107169.

Mauricio Aniche, Erick Maziero, Rafael Durelli, and Vinicius HS Durelli. 2020. The effectiveness of supervised machine learning algorithms in predicting software refactoring. IEEE Transactions on Software Engineering 48, 4 (2020), 1432–1450.

Francesca Arcelli Fontana, Mika V Mäntylä, Marco Zanoni, and Alessandro Marino. 2016. Comparing and experimenting machine learning techniques for code smell detection. Empirical Software Engineering 21 (2016), 1143–1191.

Guisella A Armijo and Valter V de Camargo. 2022. Refactoring Recommendations with Machine Learning. In Anais Estendidos do XXI Simpósio Brasileiro de Qualidade de Software. SBC, 15–22.

Muhammad Ilyas Azeem, Fabio Palomba, Lin Shi, and QingWang. 2019. Machine learning techniques for code smell detection: A systematic literature review and meta-analysis. Information and Software Technology 108 (2019), 115–138.

Abdulrahman Ahmed Bobakr Baqais and Mohammad Alshayeb. 2020. Automatic software refactoring: a systematic literature review. Software Quality Journal 28, 2 (2020), 459–502.

Di Cui, Qiangqiang Wang, Siqi Wang, Jianlei Chi, Jianan Li, Lu Wang, and Qingshan Li. 2023. REMS: Recommending Extract Method Refactoring Opportunities via Multi-view Representation of Code Property Graph. In 2023 IEEE/ACM 31st International Conference on Program Comprehension (ICPC). IEEE, 191–202.

Di Cui, Siqi Wang, Yong Luo, Xingyu Li, Jie Dai, Lu Wang, and Qingshan Li. 2022. RMove: Recommending Move Method Refactoring Opportunities using Structural and Semantic Representations of Code. In 2022 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 281–292.

Warteruzannan Soyer Cunha, Guisella Angulo Armijo, and Valter Vieira de Camargo. 2020. Investigating Non-Usually Employed Features in the Identification of Architectural Smells: A Machine Learning-Based Approach (SBCARS ’20). Association for Computing Machinery, New York, NY, USA, 21–30. DOI: 10.1145/3425269.3425281

Arun Das and Paul Rad. 2020. Opportunities and challenges in explainable artificial intelligence (xai): A survey. arXiv preprint arXiv:2006.11371 (2020).

Marios Fokaefs, Nikolaos Tsantalis, Eleni Stroulia, and Alexander Chatzigeorgiou. 2011. JDeodorant: identification and application of extract class refactorings. In 2011 33rd International Conference on Software Engineering (ICSE). IEEE.

M. Fowler and K. Beck. 2019. Refactoring: Improving the Design of Existing Code. Addison-Wesley.

Ayaka Imazato, Yoshiki Higo, Keisuke Hotta, and Shinji Kusumoto. 2017. Finding extract method refactoring opportunities by analyzing development history. In 2017 IEEE 41st Annual Computer Software and Applications Conference (COMPSAC), Vol. 1. IEEE, 190–195.

Manpreet Kaur and Dhavleesh Rattan. 2023. A systematic literature review on the use of machine learning in code clone research. Computer Science Review 47 (2023), 100528.

Barbara Kitchenham, O Pearl Brereton, David Budgen, Mark Turner, John Bailey, and Stephen Linkman. 2009. Systematic literature reviews in software engineering–a systematic literature review. Information and software technology 51, 1 (2009), 7–15.

Barbara Ann Kitchenham and Stuart Charters. 2007. Guidelines for performing Systematic Literature Reviews in Software Engineering. Technical Report EBSE 2007-001.

Lov Kumar, Shashank Mouli Satapathy, and Aneesh Krishna. 2018. Application of smote and lssvm with various kernels for predicting refactoring at method level. In International Conference on Neural Information Processing. Springer, 150–161.

Lov Kumar, Shashank Mouli Satapathy, and Ashish Sureka. 2015. Method Level Refactoring Prediction on Five Open Source Java Projects using Machine Learning Techniques.

Lov Kumar and Ashish Sureka. 2017. Application of LSSVM and SMOTE on seven open source projects for predicting refactoring at class level. In 2017 24th Asia-Pacific Software Engineering Conference (APSEC). IEEE, 90–99.

Zarina Kurbatova, Ivan Veselov, Yaroslav Golubev, and Timofey Bryksin. 2020. Recommendation of Move Method Refactoring Using Path-Based Representation of Code. In Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops. 315–322.

Hui Liu, Zhifeng Xu, and Yanzhen Zou. 2018. Deep learning based feature envy detection. In Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering. 385–396.

Tom Mens and Tom Tourwé. 2004. A survey of software refactoring. IEEE Transactions on software engineering 30, 2 (2004), 126–139.

Ally S Nyamawe. 2022. Mining commit messages to enhance software refactorings recommendation: A machine learning approach. Machine Learning with Applications (2022), 100316.

Ally S Nyamawe, Hui Liu, Nan Niu, Qasim Umer, and Zhendong Niu. 2019. Automated recommendation of software refactorings based on feature requests. In 2019 IEEE 27th International Requirements Engineering Conference (RE). IEEE, 187–198.

Ally S Nyamawe, Hui Liu, Nan Niu, Qasim Umer, and Zhendong Niu. 2020. Feature requests-based recommendation of software refactorings. Empirical Software Engineering 25, 5 (2020), 4315–4347.

Indranil Palit, Gautam Shetty, Hera Arif, and Tushar Sharma. 2023. Automatic refactoring candidate identification leveraging effective code representation. In 2023 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 369–374.

Fabio Palomba, Gabriele Bavota, Massimiliano Di Penta, Fausto Fasano, Rocco Oliveto, and Andrea De Lucia. 2018. On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation. In Proceedings of the 40th International Conference on Software Engineering. 482–482.

Rasmita Panigrahi, Sanjay Kumar Kuanar, Sanjay Misra, and Lov Kumar. 2022. Class-Level Refactoring Prediction by Ensemble Learning with Various Feature Selection Techniques. Applied Sciences 12, 23 (2022), 12217.

Rasmita Panigrahi, Lov Kumar, et al. 2020. Application of Naïve Bayes classifiers for refactoring Prediction at the method level. In 2020 International Conference on Computer Science, Engineering and Applications (ICCSEA). IEEE, 1–6.

Jevgenija Pantiuchina, Bin Lin, Fiorella Zampetti, Massimiliano Di Penta, Michele Lanza, and Gabriele Bavota. 2021. Why Do Developers Reject Refactorings in Open-Source Projects? ACM Transactions on Software Engineering and Methodology (TOSEM) 31, 2 (2021), 1–23.

Ivens Portugal, Paulo Alencar, and Donald Cowan. 2018. The use of machine learning algorithms in recommender systems: A systematic review. Expert Systems with Applications 97 (2018), 205–227.

Soumaya Rebai, Vahid Alizadeh, Marouane Kessentini, Houcem Fehri, and Rick Kazman. 2020. Enabling decision and objective space exploration for interactive multi-objective refactoring. IEEE Transactions on Software Engineering (2020).

Raana Saheb-Nassagh, Mehrdad Ashtiani, and Behrouz Minaei-Bidgoli. 2022. A probabilistic-based approach for automatic identification and refactoring of software code smells. Applied Soft Computing 130 (2022), 109658.

Abdullah M Sheneamer. 2020. An automatic advisor for refactoring software clones based on machine learning. IEEE Access 8 (2020), 124978–124988.

Brahmaleen Kaur Sidhu, Kawaljeet Singh, and Neeraj Sharma. 2022. A machine learning approach to software model refactoring. International Journal of Computers and Applications 44, 2 (2022), 166–177.

Danilo Silva, Ricardo Terra, and Marco Túlio Valente. 2015. Jextract: An eclipse plug-in for recommending automated extract method refactorings. arXiv preprint arXiv:1506.06086 (2015).

Danilo Silva, Nikolaos Tsantalis, and Marco Tulio Valente. 2016. Why we refactor? confessions of github contributors. In Proceedings of the 2016 24th acm sigsoft international symposium on foundations of software engineering. 858–870.

Danilo Silva and Marco Tulio Valente. 2017. RefDiff: Detecting Refactorings in Version Histories. In 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR). 269–279.

Jocelyn Simmonds and Tom Mens. 2002. A comparison of software refactoring tools. Programming Technology Lab (2002).

Cleiton Silva Tavares, Amanda Santana, Eduardo Figueiredo, and Mariza Bigonha. 2020. Revisiting the Bad Smell and Refactoring Relationship: A Systematic Literature Review. In Conferencia Iberoamericana de Software Engineering.

Ricardo Terra, Marco Tulio Valente, Sergio Miranda, and Vitor Sales. 2018. JMove: A novel heuristic and tool to detect move method refactoring opportunities. Journal of Systems and Software 138 (2018), 19–36.

Nikolaos Tsantalis, Matin Mansouri, Laleh M. Eshkevari, Davood Mazinanian, and Danny Dig. 2018. Accurate and Efficient Refactoring Detection in Commit History. In Proceedings of the 40th International Conference on Software Engineering (Gothenburg, Sweden) (ICSE ’18). ACM, New York, NY, USA, 483–494.

David van der Leij, Jasper Binda, Robbert van Dalen, Pieter Vallen, Yaping Luo, and Maurício Aniche. 2021. Data-driven extract method recommendations: a study at ING. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 1337–1347. SBES’24, September 30 – October 04, 2024, Curitiba, PR G. Angulo et al.

Wei Wang and Michael W Godfrey. 2014. Recommending clones for refactoring using design, context, and history. In 2014 IEEE International Conference on Software Maintenance and Evolution. IEEE, 331–340.

Sihan Xu, Chenkai Guo, Lei Liu, and Jing Xu. 2017. A log-linear probabilistic model for prioritizing extract method refactorings. In 2017 3rd IEEE International Conference on Computer and Communications (ICCC). IEEE, 2503–2507.

Sihan Xu, Aishwarya Sivaraman, Siau-Cheng Khoo, and Jing Xu. 2017. Gems: An extract method refactoring recommender. In 2017 IEEE 28th International Symposium on Software Reliability Engineering (ISSRE). IEEE, 24–34.

Ruru Yue, Zhe Gao, Na Meng, Yingfei Xiong, Xiaoyin Wang, and J David Morgenthaler. 2018. Automatic clone recommendation for refactoring based on the present and the past. In 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 115–126.
Publicado
30/09/2024
ARMIJO, Guisella Angulo; SANTIBAÑEZ, Daniel San Martín; DURELLI, Rafael; CAMARGO, Valter Vieira de. On the Employment of Machine Learning for Recommending Refactorings: A Systematic Literature Review. In: SIMPÓSIO BRASILEIRO DE ENGENHARIA DE SOFTWARE (SBES), 38. , 2024, Curitiba/PR. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2024 . p. 334-345. DOI: https://doi.org/10.5753/sbes.2024.3436.