RMMOC: Refactoring Method based on Multi-Objective Algorithms and New Criteria

Document Type : Research Article

Authors

Department of Computer Engineering, Faculty of Engineering, Alzahra University, Tehran, Iran

Abstract

Some factors can change the software and affect the quality, such as the new users' requirements and the need for compatibility with modern techniques. These factors impose a high cost on technical software maintenance. One of the techniques for software quality improvement and maintenance cost reduction is refactoring. The advantage of this method is software behavior preservation. Because the cost of refactoring manually is high, a technique called the hybrid optimization problem has been proposed. The main challenge in refactoring is to propose a technique with high accuracy and less runtime. Hence, in the present work, a refactoring method based on the multi-objective algorithms called RMMOC is proposed to tradeoff between quality and runtime. This method uses a helpful search-based method called UMOCell to increase refactoring quality. This method inspires both population-based and local-based search algorithms. Another novelty in this paper is using new metrics for program quality assessment that help increase accuracy, decrease refactoring runtime, and find the best solutions. Because software metrics play a significant role in search-based refactoring approaches, this paper introduces two effective criteria called MPC and refactoring number reduction in addition to previously presented metrics. The experiments' results show that the proposed method's performance is remarkable and that using new metrics is effective.

Keywords


[1]      B. Bafandeh Mayvan, A. Rasoolzadegan, and A. Javan Jafari, “Bad smell detection using quality metrics and refactoring opportunities,” J. Softw. Evol. Process, vol. 32, no. 8, p. e2255, 2020.
[2]      M. Akour, M. Alenezi, and H. Alsghaier, “Software refactoring prediction using SVM and optimization algorithms,” Processes, vol. 10, no. 8, p. 1611, 2022.
[3]      P. Tripathy and K. Naik, Software evolution and maintenance: a practitioner’s approach. John Wiley & Sons, 2014.
[4]      R. C. Martin, Agile software development: principles, patterns, and practices. Prentice Hall, 2002.
[5]      R. Alsarraj and others, “Refactoring for software maintenance: A Review of the literature,” J. Educ. Sci., vol. 30, no. 1, pp. 89–102, 2021.
[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,” 2022.
[7]      H. Ahmadi, M. Ashtiani, M. A. Azgomi, and R. Saheb-Nassagh, “A DQN-based agent for automatic software refactoring,” Inf. Softw. Technol., vol. 147, p. 106893, 2022.
[8]      M. Fowler, K. Beck, and W. R. Opdyke, “Refactoring: Improving the design of existing code,” in 11th European Conference. Jyväskylä, Finland, 1997.
[9]      H. Khosravi and A. Rasoolzadegan, “A Meta-Learning Approach for Software Refactoring,” arXiv Prepr. arXiv2301.08061, 2023.
[10]    W. F. Opdyke, “Refactoring: An aid in designing application frameworks and evolving object-oriented systems,” in Proc. SOOPPA’90: Symposium on Object-Oriented Programming Emphasizing Practical Applications, 1990.
[11]    B. Du Bois, S. Demeyer, J. Verelst, T. Mens, and M. Temmerman, “Does god class decomposition affect comprehensibility?,” in IASTED Conf. on Software Engineering, 2006, pp. 346–355.
[12]    R. Morales, F. Chicano, F. Khomh, and G. Antoniol, “Exact search-space size for the refactoring scheduling problem,” Autom. Softw. Eng., vol. 25, no. 2, pp. 195–200, 2018.
[13]    T. Mariani and S. R. Vergilio, “A systematic review on search-based refactoring,” Inf. Softw. Technol., vol. 83, pp. 14–34, 2017.
[14]    M. O’Keeffe and M. O. Cinnéide, “A stochastic approach to automated design improvement,” in ACM International Conference Proceeding Series, 2003, vol. 42, pp. 59–62.
[15]    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, 2023.
[16]    D. Heuzeroth, U. Aßmann, M. Trifu, and V. Kuttruff, “The COMPOST, COMPASS, Inject/J and RECODER tool suite for invasive software composition: Invasive composition with COMPASS aspect-oriented connectors,” in International Summer School on Generative and Transformational Techniques in Software Engineering, 2005, pp. 357–377.
[17]    M. Mohan, D. Greer, and P. McMullan, “Technical debt reduction using search based automated refactoring,” J. Syst. Softw., vol. 120, pp. 183–194, 2016.
[18]    Z. Razani and M. Keyvanpour, “SBSR Solution Evaluation: Methods and Challenges Classification,” in 2019 5th Conference on Knowledge Based Engineering and Innovation (KBEI), 2019, pp. 181–188.
[19]    N. Shafiei and M. R. Keyvanpour, “Challenges Classification in Search-Based Refactoring,” in 2020 6th International Conference on Web Research (ICWR), 2020, pp. 106–112.
[20]    D. C. Schmidt, “Model-driven engineering,” Comput. Comput. Soc., vol. 39, no. 2, p. 25, 2006.
[21]    A. Ghannem, G. El Boussaidi, and M. Kessentini, “Model refactoring using examples: a search-based approach,” J. Softw. Evol. Process, vol. 26, no. 7, pp. 692–713, 2014.
[22]    A. Ghannem, G. El Boussaidi, and M. Kessentini, “Model refactoring using interactive genetic algorithm,” in International Symposium on Search Based Software Engineering, 2013, pp. 96–110.
[23]    A. Ghannem, M. Kessentini, M. S. Hamdi, and G. El Boussaidi, “Model refactoring by example: A multi-objective search based software engineering approach,” J. Softw. Evol. Process, vol. 30, no. 4, p. e1916, 2018.
[24]    U. Mansoor, M. Kessentini, M. Wimmer, and K. Deb, “Multi-view refactoring of class and activity diagrams using a multi-objective evolutionary algorithm,” Softw. Qual. J., vol. 25, no. 2, pp. 473–501, 2017.
[25]    A. A. B. Baqais and M. Alshayeb, “Sequence diagram refactoring using single and hybridized algorithms,” PLoS One, vol. 13, no. 8, p. e0202629, 2018.
[26]    B. Alkhazi, T. Ruas, M. Kessentini, M. Wimmer, and W. I. Grosky, “Automated refactoring of ATL model transformations: a search-based approach,” in Proceedings of the ACM/IEEE 19th International Conference on Model Driven Engineering Languages and Systems, 2016, pp. 295–304.
[27]    M. Hentati, A. Trabelsi, L. Ben Ammar, and A. Mahfoudhi, “MoTUO: An Approach for Optimizing Usability Within Model Transformations,” Arab. J. Sci. Eng., vol. 44, no. 4, pp. 3253–3269, 2019.
[28]    M. Paixão et al., “Behind the intents: An in-depth empirical study on software refactoring in modern code review,” in Proceedings of the 17th International Conference on Mining Software Repositories, 2020, pp. 125–136.
[29]    E. Fernandes et al., “Refactoring effect on internal quality attributes: What haven’t they told you yet?,” Inf. Softw. Technol., vol. 126, p. 106347, 2020.
[30]    M. Mohan and D. Greer, “A survey of search-based refactoring for software maintenance,” J. Softw. Eng. Res. Dev., vol. 6, no. 1, pp. 1–52, 2018.
[31]    R. Morales, F. Chicano, F. Khomh, and G. Antoniol, “Efficient refactoring scheduling based on partial order reduction,” J. Syst. Softw., vol. 2, no. 5, pp. 25–51, 2018.
[32]    H. Liu, G. Li, Z. Y. Ma, and W. Z. Shao, “Conflict-aware schedule of software refactorings,” IET Softw., vol. 2, no. 5, pp. 446–460, 2008.
[33]    V. Alizadeh, M. Kessentini, W. Mkaouer, M. Ocinneide, A. Ouni, and Y. Cai, “An Interactive and Dynamic Search-Based Approach to Software Refactoring Recommendations,” IEEE Trans. Softw. Eng., 2018.
[34]    A. Ouni, M. Kessentini, M. Ó Cinnéide, H. Sahraoui, K. Deb, and K. Inoue, “MORE: A multi-objective refactoring recommendation approach to introducing design patterns and fixing code smells,” J. Softw. Evol. Process, vol. 29, no. 5, p. e1843, 2017.
[35]    M. Kessentini, T. J. Dea, and A. Ouni, “A context-based refactoring recommendation approach using simulated annealing: two industrial case studies,” in Proceedings of the Genetic and Evolutionary Computation Conference, 2017, pp. 1303–1310.
[36]    A.-R. Han and S. Cha, “Two-Phase Assessment Approach to Improve the Efficiency of Refactoring Identification,” IEEE Trans. Softw. Eng., vol. 44, no. 10, pp. 1001–1023, 2017.
[37]    M. Mohan and D. Greer, “MultiRefactor: automated refactoring to improve software quality,” in International Conference on Product-Focused Software Process Improvement, 2017, pp. 556–572.
[38]    I. Griffith, S. Wahl, and C. Izurieta, “TrueRefactor: An automated refactoring tool to improve legacy system and application comprehensibility,” in 24th International Conference on Computer Applications in Industry and Engineering, ISCA 2011, 2011.
[39]    I. H. Moghadam, “Multi-level automated refactoring using design exploration,” in International Symposium on Search Based Software Engineering, 2011, pp. 70–75.
[40]    V. Alizadeh and M. Kessentini, “Reducing interactive refactoring effort via clustering-based multi-objective search,” in 2018 33rd IEEE/ACM International Conference on Automated Software Engineering (ASE), 2018, pp. 464–474.
[41]    I. H. Moghadam and M. Ó Cinnéide, “Code-Imp: A tool for automated search-based refactoring,” in Proceedings of the 4th Workshop on Refactoring Tools, 2011, pp. 41–44.
[42]    I. H. Moghadam and M. O. Cinnéide, “Resolving conflict and dependency in refactoring to a desired design,” e-Informatica Softw. Eng. J., vol. 9, no. 1, 2015.
[43]    M. O’Keeffe and M. Ó. Cinnéide, “Search-based software maintenance,” in Conference on software maintenance and reengineering (CSMR’06), 2006, pp. 10--pp.
[44]    M. O’Keeffe and M. O. Cinnéide, “Search-based refactoring for software maintenance,” J. Syst. Softw., vol. 81, no. 4, pp. 502–516, 2008.
[45]    E. Murphy-Hill and A. P. Black, “Refactoring tools: Fitness for purpose,” IEEE Softw., vol. 25, no. 5, pp. 38–44, 2008.
[46]    R. Morales, Z. Soh, F. Khomh, G. Antoniol, and F. Chicano, “On the use of developers’ context for automatic refactoring of software anti-patterns,” J. Syst. Softw., vol. 128, pp. 236–251, 2017.
[47]    M. W. Mkaouer, M. Kessentini, M. Ó. Cinnéide, S. Hayashi, and K. Deb, “A robust multi-objective approach to balance severity and importance of refactoring opportunities,” Empir. Softw. Eng., vol. 22, no. 2, pp. 894–927, 2017.
[48]    H. Wang, M. Kessentini, and A. Ouni, “Interactive refactoring of web service interfaces using computational search,” IEEE Trans. Serv. Comput., 2017.
[49]    A. Ouni, M. Kessentini, H. Sahraoui, K. Inoue, and K. Deb, “Multi-criteria code refactoring using search-based software engineering: An industrial case study,” ACM Trans. Softw. Eng. Methodol., vol. 25, no. 3, pp. 1–53, 2016.
[50]    E. Murphy-Hill, C. Parnin, and A. P. Black, “How we refactor, and how we know it,” IEEE Trans. Softw. Eng., vol. 38, no. 1, pp. 5–18, 2011.
[51]    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, 2007, pp. 1106–1113.
[52]    S. Kebir, I. Borne, and D. Meslati, “A genetic algorithm-based approach for automated refactoring of component-based software,” Inf. Softw. Technol., vol. 88, pp. 17–36, 2017.
[53]    O. Seng, J. Stammel, and D. Burkhart, “Search-based determination of refactorings for improving the class structure of object-oriented systems,” in Proceedings of the 8th annual conference on Genetic and evolutionary computation, 2006, pp. 1909–1916.
[54]    M. W. Mkaouer, M. Kessentini, S. Bechikh, M. Ó. Cinnéide, and K. Deb, “On the use of many quality attributes for software refactoring: a many-objective search-based software engineering approach,” Empir. Softw. Eng., vol. 21, no. 6, pp. 2503–2545, 2016.
[55]    A. L. Jaimes, C. A. C. Coello, and J. E. U. Barrientos, “Online objective reduction to deal with many-objective problems,” in International Conference on Evolutionary Multi-Criterion Optimization, 2009, pp. 423–437.
[56]    H. Ishibuchi, N. Tsukamoto, and Y. Nojima, “Evolutionary many-objective optimization: A short review,” in 2008 IEEE Congress on Evolutionary Computation (IEEE World Congress on Computational Intelligence), 2008, pp. 2419–2426.
[57]    M. W. Mkaouer, M. Kessentini, S. Bechikh, K. Deb, and M. Ó Cinnéide, “High dimensional search-based software engineering: finding tradeoffs among 15 objectives for automating software refactoring using NSGA-III,” in Proceedings of the 2014 Annual Conference on Genetic and Evolutionary Computation, 2014, pp. 1263–1270.
[58]    D. Meignan, S. Knust, J.-M. Frayret, G. Pesant, and N. Gaud, “A review and taxonomy of interactive optimization methods in operations research,” ACM Trans. Interact. Intell. Syst., vol. 5, no. 3, pp. 1–43, 2015.
[59]    A. Ramirez, J. R. Romero, and C. L. Simons, “A systematic review of interaction in search-based software engineering,” IEEE Trans. Softw. Eng., vol. 45, no. 8, pp. 760–781, 2018.
[60]    K. Deb, A. Pratap, S. Agarwal, and T. Meyarivan, “A fast and elitist multiobjective genetic algorithm: NSGA-II,” IEEE Trans. Evol. Comput., vol. 6, no. 2, pp. 182–197, 2002.
[61]    A. J. Nebro, J. J. Durillo, F. Luna, B. Dorronsoro, and E. Alba, “Mocell: A cellular genetic algorithm for multiobjective optimization,” Int. J. Intell. Syst., vol. 24, no. 7, pp. 726–746, 2009.
[62]    P. K. Goyal and G. Joshi, “QMOOD metric sets to assess quality of Java program,” in 2014 International Conference on Issues and Challenges in Intelligent Computing Techniques (ICICT), 2014, pp. 520–533.
[63]    D. Boshnakoska and A. Mišev, “Correlation between object-oriented metrics and refactoring,” in International Conference on ICT Innovations, 2010, pp. 226–235.
[64]    W. Li and S. Henry, “Object-oriented metrics that predict maintainability,” J. Syst. Softw., vol. 23, no. 2, pp. 111–122, 1993.
[65]    M. Harman, Y. Jia, and Y. Zhang, “Achievements, open problems and challenges for search based software testing,” in 2015 IEEE 8th International Conference on Software Testing, Verification and Validation (ICST), 2015, pp. 1–12.
[66]    G. Antoniol, M. Di Penta, and M. Harman, “Search-based techniques applied to optimization of project planning for a massive maintenance project,” in 21st IEEE International Conference on Software Maintenance (ICSM’05), 2005, pp. 240–249.
[67]    A. Ouni, M. Kessentini, H. Sahraoui, and M. Boukadoum, “Maintainability defects detection and correction: a multi-objective approach,” Autom. Softw. Eng., vol. 20, no. 1, pp. 47–79, 2013.
[68]    A. Ouni, M. Kessentini, S. Bechikh, and H. Sahraoui, “Prioritizing code-smells correction tasks using chemical reaction optimization,” Softw. Qual. J., vol. 23, no. 2, pp. 323–361, 2015.
[69]    R. Morales, R. Saborido, F. Khomh, F. Chicano, and G. Antoniol, “Earmo: an energy-aware refactoring approach for mobile apps,” IEEE Trans. Softw. Eng., vol. 44, no. 12, pp. 1176–1206, 2017.