Automatic Software Refactoring to Enhance Quality: A Review

Authors

  • Shahbaa I. Khaleel Department of Software, College of Computer Science and Mathematics, University of Mosul, Mosul, Iraq
  • Rasha Ahmed Mahmood Department of Software, College of Computer Science and Mathematics, University of Mosul, Mosul, Iraq

DOI:

https://doi.org/10.26555/jiteki.v10i4.30277

Keywords:

Refactoring Recommendation, Machine Learning Algorithms in Predicting Software Refactoring, Refactoring in a Code Review, Refactoring Prediction through Deep Learning, Refactoring Methods

Abstract

Refactoring aims to enhance the internal structure of the code and improve maintainability without affecting its functionality and external behavior. As a result of the development of technologies, it has become necessary to apply automatic refactoring to address complexities and reduce technical debt. This review presents machine learning and deep learning techniques that lead to identifying opportunities for the need for refactoring and implementing them through analyzing the software code and discovering "code smells", where the focus is on the role of tools such as RefactoringMiner, CODEBERT in enhancing the accuracy of prediction. This review presents various methodologies that include metrics-based methods, search, machine learning and discusses their impact on software quality. The review reviews experimental studies that focus on the challenges of refactoring such as reducing the risks associated with making unnecessary modifications and determining the appropriate timing. Notable empirical studies include a study by Bavota et al., in which Ref-Finder was used to detect 15,008 refactorings in open source software systems, identifying 85% of which improved code quality and reduced bugs. Additionally, another study by Khatchadourian et al. demonstrated the effectiveness of OPTIMIZE STREAMS in improving code performance in large Java projects, increasing efficiency by 55% on average. The study presents two research contributions. The first is a comprehensive analysis of automated refactoring techniques using machine learning algorithms, in addition to improving maintainability and reducing complexity. The second contribution is to provide recommendations to support developers in using modern tools and choosing the right timing for refactoring, which enhances code productivity. The results showed that machine learning techniques can significantly enhance the efficiency of refactoring and thus support developers in making accurate decisions in enhancing maintainability.

References

[1] E. Zabardast, J. Gonzalez-Huerta, and D. Smite, “Refactoring, Bug Fixing, and New Development Effect on Technical Debt: An Industrial Case Study,” in 2020 46th Euromicro Conference on Software Engineering and Advanced Applications (SEAA), pp. 376–384, Aug. 2020, https://doi.org/10.1109/SEAA51224.2020.00068.

[2] M. Tufano et al., “When and Why Your Code Starts to Smell Bad,” in 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering, pp. 403–414, May 2015, https://doi.org/10.1109/ICSE.2015.59.

[3] H. Khosravi and A. Rasoolzadegan, “A Meta-Learning Approach for Software Refactoring,” SSRN, 2023, https://doi.org/10.2139/ssrn.4355385.

[4] S. I. Khaleel and G. K. Al-Khatouni, “A literature review for measuring maintainability of code clone,” Indones. J. Electr. Eng. Comput. Sci., vol. 31, no. 2, p. 1118, Aug. 2023, https://doi.org/10.11591/ijeecs.v31.i2.pp1118-1127.

[5] M. Kim, T. Zimmermann, and N. Nagappan, “A field study of refactoring challenges and benefits,” in Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering, pp. 1–11, Nov. 2012, https://doi.org/10.1145/2393596.2393655.

[6] S. M. Akhtar, M. Nazir, A. Ali, A. S. Khan, M. Atif, and M. Naseer, “A Systematic Literature Review on Software- refactoring Techniques, Challenges, and Practices,” VFAST Trans. Softw. Eng., vol. 10, no. 4, pp. 93-103, 2022, https://doi.org/10.21015/vtse.v10i4.1275.

[7] N. Tsantalis, T. Chaikalis, and A. Chatzigeorgiou, “JDeodorant: Identification and Removal of Type-Checking Bad Smells,” in 2008 12th European Conference on Software Maintenance and Reengineering, Athens: IEEE, pp. 329–331, Apr. 2008, https://doi.org/10.1109/CSMR.2008.4493342.

[8] E. A. AlOmar, A. Peruma, M. W. Mkaouer, C. Newman, A. Ouni, and M. Kessentini, “How We Refactor and How We Document it? On the Use of Supervised Machine Learning Algorithms to Classify Refactoring Documentation,” Expert Syst. Appl., vol. 167, p. 114176, Apr. 2021, https://doi.org/10.1016/j.eswa.2020.114176.

[9] B. Nyirongo, Y. Jiang, H. Jiang, and H. Liu, “A Survey of Deep Learning Based Software Refactoring”.

[10] J. P. dos Reis, F. B. e Abreu, G. de F. Carneiro, and C. Anslow, “Code smells detection and visualization: A systematic literature review,” Arch. Comput. Methods Eng., vol. 29, no. 1, pp. 47–94, Jan. 2022, https://doi.org/10.1007/s11831-021-09566-x.

[11] T. Tourwe and T. Mens, “Identifying refactoring opportunities using logic meta programming,” in Seventh European Conference onSoftware Maintenance and Reengineering, 2003. Proceedings., pp. 91–100, 2003, https://doi.org/10.1109/CSMR.2003.1192416.

[13] M. Abebe and C.-J. Yoo, “Trends, Opportunities and Challenges of Software Refactoring: A Systematic Literature Review,” Int. J. Softw. Eng. Its Appl., 2014, http://dx.doi.org/10.14257/ijseia.2014.8.6.24'.

[14] J. Gerling, “Machine Learning for Software Refactoring: a Large-Scale Empirical Study,” 2020, https://repository.tudelft.nl/record/uuid:bf649e9c-9d53-4e8c-a91b-f0a6b6aab733.

[15] R. Marinescu, “Detection strategies: metrics-based rules for detecting design flaws,” in 20th IEEE International Conference on Software Maintenance, 2004. Proceedings., pp. 350–359, 2004, https://doi.org/10.1109/ICSM.2004.1357820.

[16] N. Moha, Y.-G. Gueheneuc, L. Duchien, and A.-F. Le Meur, “DECOR: A Method for the Specification and Detection of Code and Design Smells,” IEEE Trans. Softw. Eng., vol. 36, no. 1, pp. 20–36, Jan. 2010, https://doi.org/10.1109/TSE.2009.50.

[17] M. O’Keeffe and M. Ó Cinnéide, “Search-based refactoring for software maintenance,” J. Syst. Softw., vol. 81, no. 4, pp. 502–516, Apr. 2008, https://doi.org/10.1016/j.jss.2007.06.003.

[18] M. Harman and L. Tratt, “Pareto optimal search based refactoring at the design level,” in Proceedings of the 9th annual conference on Genetic and evolutionary computation, pp. 1106–1113. Jul. 2007, https://doi.org/10.1145/1276958.1277176.

[19] M. Mohan and D. Greer, “A survey of search-based refactoring for software maintenance,” J. Softw. Eng. Res. Dev., vol. 6, no. 1, p. 3, Dec. 2018, https://doi.org/10.1186/s40411-018-0046-4.

[20] M. K. O’Keeffe and M. O. Cinneide, “Getting the most from search-based refactoring,” in Proceedings of the 9th annual conference on Genetic and evolutionary computation, pp. 1114–1120, Jul. 2007, https://doi.org/10.1145/1276958.1277177.

[21] N. Nikolaidis, D. Zisis, A. Ampatzoglou, N. Mittas, and A. Chatzigeorgiou, “Using machine learning to guide the application of software refactorings: a preliminary exploration,” in Proceedings of the 6th International Workshop on Machine Learning Techniques for Software Quality Evaluation, pp. 23–28, Nov. 2022, https://doi.org/10.1145/3549034.3561178.

[22] B. K. Sidhu, K. Singh, and N. Sharma, “A machine learning approach to software model refactoring,” Int. J. Comput. Appl., vol. 44, no. 2, pp. 166–177, Feb. 2022, https://doi.org/10.1080/1206212X.2020.1711616.

[23] M. Aniche, E. Maziero, R. Durelli, and V. Durelli, “The Effectiveness of Supervised Machine Learning Algorithms in Predicting Software Refactoring,” arXiv: arXiv:2001.03338. 2020, https://doi.org/10.48550/arXiv.2001.03338.

[24] M. Akour, M. Alenezi, and H. Alsghaier, “Software Refactoring Prediction Using SVM and Optimization Algorithms,” Processes, vol. 10, no. 8, p. 1611, Aug. 2022, https://doi.org/10.3390/pr10081611.

[25] J. Ratzinger, T. Sigmund, P. Vorburger, and H. Gall, “Mining Software Evolution to Predict Refactoring,” in First International Symposium on Empirical Software Engineering and Measurement (ESEM 2007), pp. 354–363. Sep. 2007, https://doi.org/10.1109/ESEM.2007.9.

[26] L. Kumar and A. Sureka, “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), pp. 90–99, Dec. 2017, https://doi.org/10.1109/APSEC.2017.15.

[27] M. Fowler and K. Beck, Refactoring: improving the design of existing code, Second edition. in The Addison-Wesley signature series. Boston Columbus New York San Francisco Amsterdam Cape Town Dubai London Munich: Addison-Wesley, 2019. https://archive.org/details/RefactoringImprovingTheDesignOfExistingCode1stEditionByMartinFowlerKentBeckJohnB.

[28] X. Ge, S. Sarkar, and E. Murphy-Hill, “Towards refactoring-aware code review,” in Proceedings of the 7th International Workshop on Cooperative and Human Aspects of Software Engineering, pp. 99–102, Jun. 2014, https://doi.org/10.1145/2593702.2593706.

[29] E. A. AlOmar, H. AlRubaye, M. W. Mkaouer, A. Ouni, and M. Kessentini, “Refactoring Practices in the Context of Modern Code Review: An Industrial Case Study at Xerox,” arXiv: arXiv:2102.05201, 2021, https://doi.org/10.48550/arXiv.2102.05201.

[30] A. Arpteg, B. Brinne, L. Crnkovic-Friis, and J. Bosch, “Software Engineering Challenges of Deep Learning,” in 2018 44th Euromicro Conference on Software Engineering and Advanced Applications (SEAA), pp. 50–59, Aug. 2018, https://doi.org/10.1109/SEAA.2018.00018.

[31] M. Jeevanantham, J. Jones, “Extension of Deep Learning Based Feature Envy Detection for Misplaced Fields and Methods,” Int. J. Intell. Eng. Syst., vol. 15, no. 1, Feb. 2022, https://doi.org/10.22266/ijies2022.0228.51.

[32] Z. Feng et al., “CodeBERT: A Pre-Trained Model for Programming and Natural Languages,” arXiv: arXiv:2002.08155, 2020, https://doi.org/10.48550/arXiv.2002.08155.

[33] L. R. R. Pereira, D. L. Pereira, and R. S. Durelli, “Realizing Refactoring Prediction through Deep Learning,” in Anais do III Workshop Brasileiro de Engenharia de Software Inteligente (ISE 2023), BSep. 2023, pp. 7–12. https://doi.org/10.5753/ise.2023.235749.

[34] A. Almogahed, H. Mahdin, M. Omar, N. H. Zakaria, G. Muhammad, and Z. Ali, “Optimized Refactoring Mechanisms to Improve Quality Characteristics in Object-Oriented Systems,” IEEE Access, vol. 11, pp. 99143–99158, 2023, https://doi.org/10.1109/ACCESS.2023.3313186.

[35] A. Almogahed, M. Omar, N. H. Zakaria, G. Muhammad, and S. A. AlQahtani, “Revisiting Scenarios of Using Refactoring Techniques to Improve Software Systems Quality,” IEEE Access, vol. 11, pp. 28800–28819, 2023, https://doi.org/10.1109/ACCESS.2022.3218007.

[36] E. Murphy-Hill and A. P. Black, “Breaking the barriers to successful refactoring: observations and tools for extract method,” in Proceedings of the 13th international conference on Software engineering - ICSE ’08, p. 421, 2008, https://doi.org/10.1145/1368088.1368146.

[37] N. Tsantalis and A. Chatzigeorgiou, “Identification of extract method refactoring opportunities for the decomposition of methods,” J. Syst. Softw., vol. 84, no. 10, pp. 1757–1782, Oct. 2011, https://doi.org/10.1016/j.jss.2011.05.016.

[38] G. Bavota, B. De Carluccio, A. De Lucia, M. Di Penta, R. Oliveto, and O. Strollo, “When Does a Refactoring Induce Bugs? An Empirical Study,” in 2012 IEEE 12th International Working Conference on Source Code Analysis and Manipulation, pp. 104–113, Sep. 2012, https://doi.org/10.1109/SCAM.2012.20.

[39] A. Ghannem, G. El Boussaidi, and M. Kessentini, “Model Refactoring Using Interactive Genetic Algorithm,” in Search Based Software Engineering, vol. 8084, pp. 96–110, 2013, https://doi.org/10.1007/978-3-642-39742-4_9.

[40] G. Bavota, A. De Lucia, A. Marcus, and R. Oliveto, “Automating extract class refactoring: an improved method and its evaluation,” Empir. Softw. Eng., vol. 19, no. 6, pp. 1617–1664, Dec. 2014, https://doi.org/10.1007/s10664-013-9256-x.

[41] R. Malhotra and A. Chug, “An empirical study to assess the effects of refactoring on software maintainability,” in 2016 International Conference on Advances in Computing, Communications and Informatics (ICACCI), pp. 110–117, Sep. 2016, https://doi.org/10.1109/ICACCI.2016.7732033.

[42] M. Mohan and D. Greer, “MultiRefactor: Automated Refactoring to Improve Software Quality,” in Product-Focused Software Process Improvement, vol. 10611, pp. 556–572, 2017, https://doi.org/10.1007/978-3-319-69926-4_46.

[43] M. Pozza, A. Rao, A. Bujari, H. Flinck, C. E. Palazzi, and S. Tarkoma, “A refactoring approach for optimizing mobile networks,” in 2017 IEEE International Conference on Communications (ICC), pp. 1–6, May 2017, https://doi.org/10.1109/ICC.2017.7996650.

[44] I. N. Ikhsan and M. Z. Catur Candra, “Automatically: An Automated Refactoring Method and Tool for Improving Web Accessibility,” in 2018 5th International Conference on Data and Software Engineering (ICoDSE), pp. 1–6, Nov. 2018, https://doi.org/10.1109/ICODSE.2018.8705894.

[45] R. T. Khatchadourian, Y. Tang, M. Bagherzadeh, and S. Ahmed, “A Tool for Optimizing Java 8 Stream Software via Automated Refactoring” https://mbagherz.bitbucket.io/lab-correct-software/papers/stream-refactoring-tool.pdf.

[46] L. Cruz and R. Abreu, “Using Automatic Refactoring to Improve Energy Efficiency of Android Apps,” arXiv: arXiv:1803.05889, 2018, https://doi.org/10.48550/arXiv.1803.05889.

[47] R. Saheb Nasagh, M. Shahidi, and M. Ashtiani, “A fuzzy genetic automatic refactoring approach to improve software maintainability and flexibility,” Soft Comput., vol. 25, no. 6, pp. 4295–4325, Mar. 2021, https://doi.org/10.1007/s00500-020-05443-0.

[48] S. Tarwani and A. Chug, “Assessment of optimum refactoring sequence to improve the software quality of object-oriented software,” J. Inf. Optim. Sci., vol. 41, no. 6, pp. 1433–1442, Aug. 2020, https://doi.org/10.1080/02522667.2020.1809097.

[49] J. P. Sandoval Alcocer, A. Siles Antezana, G. Santos, and A. Bergel, “Improving the success rate of applying the extract method refactoring,” Sci. Comput. Program., vol. 195, p. 102475, Sep. 2020, https://doi.org/10.1016/j.scico.2020.102475.

[50] D. D. Pompeo and M. Tucci, “Search Budget in Multi-Objective Refactoring Optimization: a Model-Based Empirical Study,” in 2022 48th Euromicro Conference on Software Engineering and Advanced Applications (SEAA), pp. 406–413, Aug. 2022, https://doi.org/10.1109/SEAA56994.2022.00070.

[51] F. Durán and G. Salaün, “Optimization of BPMN Processes via Automated Refactoring,” in Service-Oriented Computing, vol. 13740, pp. 3–18, 2022, https://doi.org/10.1007/978-3-031-20984-0_1.

[52] V. Cortellessa, D. Di Pompeo, V. Stoico, and M. Tucci, “Many-objective optimization of non-functional attributes based on refactoring of software models,” Inf. Softw. Technol., vol. 157, p. 107159, May 2023, https://doi.org/10.1016/j.infsof.2023.107159.

Downloads

Published

2024-12-13

How to Cite

[1]
S. I. Khaleel and R. A. Mahmood, “Automatic Software Refactoring to Enhance Quality: A Review”, J. Ilm. Tek. Elektro Komput. Dan Inform, vol. 10, no. 4, pp. 734–746, Dec. 2024.

Issue

Section

Articles

Similar Articles

1 2 3 > >> 

You may also start an advanced similarity search for this article.