Skip to main content
Log in

MIRROR: multi-objective refactoring recommendation via correlation analysis

  • Published:
Automated Software Engineering Aims and scope Submit manuscript

Abstract

Refactoring is a critical but complex process to improve code quality by altering software structure without changing the observable behavior. Search-based approaches have been proposed to recommend refactoring solutions. However, existing works tend to leverage all the sub-attributes in an objective and ignore the relationship between the sub-attributes. Furthermore, the types of refactoring operations in the existing works can be further augmented. To this end, this paper proposes a novel approach, called MIRROR, to recommend refactoring by employing a multi-objective optimization across three objectives: (i) improving quality, (ii) removing code smell, and (iii) maximizing the similarity to refactoring history. Unlike previous works, MIRROR provides a way to further optimize attributes in each objective. To be more specific, given an objective, MIRROR investigates the possible correlations among attributes and selects those attributes with low correlations as the representation of this objective. MIRROR is evaluated on 6 real-world projects by answering 6 research questions. The experimental results demonstrate that MIRROR recommends an average of 43 solutions for each project. Furthermore, we compare MIRROR against existing tools JMove and QMove, and show that the F1 of MIRROR is 5.63% and 3.75% higher than that of JMove and QMove, demonstrating the effectiveness of MIRROR.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11

Similar content being viewed by others

Data availability

The data generated during and/or analyzed during the current study are available at https://uzhangyang.github.io/research/mirror.html.

References

  • Alizadeh, V., Kessentini, M., Mkaouer, M.W., Ocinneide, M., Ouni, A., Cai, Y.: An interactive and dynamic search-based approach to software refactoring recommendations. IEEE Trans. Softw. Eng. 46(9), 932–961 (2020). https://doi.org/10.1109/TSE.2018.2872711

    Article  Google Scholar 

  • Aniche, M.F., Maziero, E., Durelli, R.S., Durelli, V.H.S.: The effectiveness of supervised machine learning algorithms in predicting software refactoring, CoRR abs/2001.03338 (2020). arXiv:2001.03338

  • Antezana, A.S.: TOAD: a tool for recommending auto-refactoring alternatives, in: J. M. Atlee, T. Bultan, J. Whittle (Eds.), Proceedings of the 41st International Conference on Software Engineering: Companion Proceedings, ICSE 2019, Montreal, QC, Canada, May 25-31, 2019, IEEE ACM, pp. 174–176 (2019). https://doi.org/10.1109/ICSE-Companion.2019.00071

  • Apacheant: (2022). http://ant.apache.org/

  • Arcuri, A., Fraser, G.: Parameter tuning or default values? an empirical investigation in search-based software engineering. Empir. Softw. Eng. 18(3), 594–623 (2013). https://doi.org/10.1007/s10664-013-9249-9

    Article  Google Scholar 

  • Bansiya, J., Davis, C.G.: A hierarchical model for object-oriented design quality assessment. IEEE Trans. Softw. Eng. 28(1), 4–17 (2002). https://doi.org/10.1109/32.979986

    Article  Google Scholar 

  • Bell, D.: Software engineering: A programming approach, software engineering: a programming approach (2000)

  • Brown, W.J., Malveau, R.C., Mccormick, H.W., Mowbray, T.J.: Anti patterns: Refactoring software, architectures, and projects in crisis (1998)

  • Cinnéide, M. Ó., Tratt, L., Harman, M., Counsell, S., Moghadam, I.H.: Experimental assessment of software metrics using automated refactoring, in: P. Runeson, M. Höst, E. Mendes, A. A. Andrews, R. Harrison (Eds.), 2012 ACM-IEEE International Symposium on Empirical Software Engineering and Measurement, ESEM ’12, Lund, Sweden - September 19 - 20, 2012, ACM, pp. 49–58 (2012). https://doi.org/10.1145/2372251.2372260

  • Couto, C.M.S., Rocha, H., Terra, R.: A quality-oriented approach to recommend move method refactorings, in: A. Malucelli, S. S. Reinehr (Eds.), Proceedings of the 17th Brazilian Symposium on Software Quality, SBQS 2018, Curitiba, Brazil, October 17-19, 2018, ACM, pp. 11–20 (2018). https://doi.org/10.1145/3275245.3275247

  • Deb, K., Agrawal, S., Pratap, A., Meyarivan, T.: A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE Trans. Evol. Comput. 6(2), 182–197 (2002). https://doi.org/10.1109/4235.996017

    Article  Google Scholar 

  • Deb, K., Saxena, D.: Searching for pareto-optimal solutions through dimensionality reduction for certain large-dimensional multi-objective optimization problems. Comput. Intell. 56, 3352–3360 (2006)

    Google Scholar 

  • Deb, K., Jain, H.: An evolutionary many-objective optimization algorithm using reference-point-based nondominated sorting approach, part i: Solving problems with box constraints. IEEE Trans. Evol. Comput. 18(4), 577–601 (2014)

    Article  Google Scholar 

  • Erlikh. L.: Leveraging legacy system dollars for e-business. IT Prof. 2(3), 17–23 (2000). https://doi.org/10.1109/6294.846201

  • Fokaefs, M., Tsantalis, N., Chatzigeorgiou, A.: Jdeodorant: Identification and removal of feature envy bad smells, in: 23rd IEEE International Conference on Software Maintenance (ICSM 2007), October 2-5, 2007, Paris, France, IEEE Computer Society, pp. 519–520 (2007). https://doi.org/10.1109/ICSM.2007.4362679

  • Foster, S.R., Griswold, W.G., Lerner, S.: Witchdoctor: IDE support for real-time auto-completion of refactorings, in: M. Glinz, G. C. Murphy, M. Pezzè (Eds.), 34th International Conference on Software Engineering, ICSE 2012, June 2-9, 2012, Zurich, Switzerland, IEEE Computer Society, pp. 222–232 (2012). https://doi.org/10.1109/ICSE.2012.6227191

  • Fowler, M.: Refactoring - improving the design of existing code (1997). URL http://martinfowler.com/books/refactoring.html

  • Ganttproject: (2022). www.ganttproject.biz

  • Griffith, I., Wahl, S., Izurieta, C.: Truerefactor: An automated refactoring tool to improve legacy system and application comprehensibility, in: 24th Intenational Conference on Computer Applications in Industry and Engineering 2011, Couer Science Deren, Monn Se Universiy, Honolulu, Hawaii, USA, pp. 316–321 (2011)

  • https://github.com/amir-zad-1/Java-QMOOD-Calculator. (2018)

  • Jfreechart: (2022). http://www.jfree.org/jfreechart/

  • Jhotdraw: (2022). http://www.jhotdraw.org/

  • Kessentini, W., Kessentini, M., Sahraoui, H.A., Bechikh, S., Ouni, A.: A cooperative parallel search-based software engineering approach for code-smells detection. IEEE Trans. Softw. Eng. 40(9), 841–861 (2014). https://doi.org/10.1109/TSE.2014.2331057

    Article  Google Scholar 

  • Koza, J.R.: Genetic programming on the programming of computers by means of natural selection. MIT Press, Complex adaptive systems (1993)

    Google Scholar 

  • Lin, Y., Peng, X., Cai, Y., Dig, D., Zheng, D., Zhao, W.: Interactive and guided architectural refactoring with search-based recommendation, in: T. Zimmermann, J. Cleland-Huang, Z. Su (Eds.), Proceedings of the 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2016, Seattle, WA, USA, November 13-18, 2016, ACM, pp. 535–546 (2016). https://doi.org/10.1145/2950290.2950317

  • Mariani, T., Vergilio, S.R.: A systematic review on search-based refactoring. Inf. Softw. Technol. 83, 14–34 (2017). https://doi.org/10.1016/j.infsof.2016.11.009

    Article  Google Scholar 

  • Marinescu, C., Marinescu, R., Mihancea, P.F., Ratiu, D., Wettel, R.: iplasma: An integrated platform for quality assessment of object-oriented design, in: Proceedings of the 21st IEEE International Conference on Software Maintenance - Industrial and Tool volume, ICSM 2005, 25-30 September 2005, Budapest, Hungary, pp. 77–80 (2005)

  • Mkaouer, M.W., Kessentini, M., Bechikh, S., Deb, K., Cinnéide, M. Ó.: Recommendation system for software refactoring using innovization and interactive dynamic optimization, in: I. Crnkovic, M. Chechik, P. Grünbacher (Eds.), ACM/IEEE International Conference on Automated Software Engineering, ASE ’14, Vasteras, Sweden - September 15 - 19, ACM, 2014, pp. 331–336 (2014). https://doi.org/10.1145/2642937.2642965

  • Mkaouer, W., Kessentini, M., Shaout, A., Koligheu, P., Bechikh, S., Deb, K., Ouni, A.: Many-objective software remodularization using NSGA-III. ACM Trans. Softw. Eng. Methodol. (TOSEM) 24(3), 1–45 (2015). https://doi.org/10.1145/2729974

    Article  Google Scholar 

  • Moha, N., Hacene, A.R., Valtchev, P., Guéhéneuc, Y.: Refactorings of design defects using relational concept analysis, in: R. Medina, S. A. Obiedkov (Eds.), Formal Concept Analysis, 6th International Conference, ICFCA 2008, Montreal, Canada, February 25-28, Proceedings, Vol. 4933 of Lecture Notes in Computer Science, Springer, 2008, pp. 289–304 (2008). https://doi.org/10.1007/978-3-540-78137-0_21

  • Moha, N., Guéhéneuc, Y., Duchien, L., Meur, A.L.: DECOR: A method for the specification and detection of code and design smells. IEEE Trans. Softw. Eng. 36(1), 20–36 (2010). https://doi.org/10.1109/TSE.2009.50

    Article  Google Scholar 

  • Mohan, M., Greer, D.: Multirefactor: Automated refactoring to improve software quality, in: M. Felderer, D. M. Fernández, B. Turhan, M. Kalinowski, F. Sarro, D. Winkler (Eds.), Product-Focused Software Process Improvement - 18th International Conference, PROFES 2017, Innsbruck, Austria, November 29 - December 1, 2017, Proceedings, Vol. 10611 of Lecture Notes in Computer Science, Springer International Publishing, pp. 556–572 (2017). https://doi.org/10.1007/978-3-319-69926-4_46

  • Nan, W., Song, F., Li, X.: Quantum search-based software engineering: an exploratory study. Sci. Sin. Inf. 45(5), 623 (2015)

    Google Scholar 

  • Ouni, A., Kessentini, M., Sahraoui, H.A., Boukadoum, M.: Maintainability defects detection and correction: a multi-objective approach. Autom. Softw. Eng. 20(1), 47–79 (2013). https://doi.org/10.1007/s10515-011-0098-8

    Article  Google Scholar 

  • Ouni, A., Kessentini, M., Sahraoui, H.A., Hamdi, M.S.: The use of development history in software refactoring using a multi-objective evolutionary algorithm, in: C. Blum, E. Alba (Eds.), Genetic and Evolutionary Computation Conference, GECCO ’13, Amsterdam, The Netherlands, July 6-10, ACM, 2013, pp. 1461–1468 (2013). https://doi.org/10.1145/2463372.2463554

  • Ouni, A., Kessentini, M., Sahraoui, H.A., Inoue, K., Deb, K.: Multi-criteria code refactoring using search-based software engineering: an industrial case study. ACM Trans. Softw. Eng. Methodol. 25(3), 23–53 (2016). https://doi.org/10.1145/2932631

    Article  Google Scholar 

  • Ouni, A., Kessentini, M., Cinnéide, M.Ó., Sahraoui, H.A., Deb, K., Inoue, K.: MORE: a multi-objective refactoring recommendation approach to introducing design patterns and fixing code smells. J. Softw. Evol. Process 29(5), e1843 (2017). https://doi.org/10.1002/smr.1843

    Article  Google Scholar 

  • Ouni, A.: A multi-objective refactoring approach to introduce design patterns and fix anti-patterns (2015)

  • O’Keeffe, M., Cinnéide, M.Ó.: Search-based refactoring: an empirical study. J. Softw. Maint. Res. Pract. 20(5), 345–364 (2008). https://doi.org/10.1002/smr.378

    Article  Google Scholar 

  • Palomba, F., Bavota, G., Penta, M.D., Oliveto, R., Poshyvanyk, D., Lucia, A.D.: Mining version histories for detecting code smells. IEEE Trans. Softw. Eng. 41(5), 462–489 (2015). https://doi.org/10.1109/TSE.2014.2372760

    Article  Google Scholar 

  • Praditwong, K., Harman, M., Yao, X.: Software module clustering as a multi-objective search problem. IEEE Trans. Softw. Eng. 37(2), 264–282 (2011). https://doi.org/10.1109/TSE.2010.26

    Article  Google Scholar 

  • Rebai, S., Kessentini, M., Alizadeh, V., Sghaier, O.B., Kazman, R.: Recommending refactorings via commit message analysis. Inf. Softw. Technol. 126, 106332 (2020). https://doi.org/10.1016/j.infsof.2020.106332

    Article  Google Scholar 

  • Rhino: (2022). http://www.mozilla.org/rhino/

  • Silva, D., Terra, R., Valente, M.T.: Jextract: An eclipse plug-in for recommending automated extract method refactorings (2015). arXiv: abs/1506.06086

  • Terra, R., Valente, M.T., Miranda, S., Sales, V.: Jmove: A novel heuristic and tool to detect move method refactoring opportunities. J. Syst. Softw. 138, 19–36 (2018). https://doi.org/10.1016/j.jss.2017.11.073

    Article  Google Scholar 

  • Tsantalis, N., Mansouri, M., Eshkevari, L.M., Mazinanian, D., Dig, D.: Accurate and efficient refactoring detection in commit history, in: M. Chaudron, I. Crnkovic, M. Chechik, M. Harman (Eds.), Proceedings of the 40th International Conference on Software Engineering, ICSE 2018, Gothenburg, Sweden, May 27 - June 03, 2018, ACM, pp. 483–494 (2018). https://doi.org/10.1145/3180155.3180206

  • Ujihara, N., Ouni, A., Ishio, T., Inoue, K.: c-jrefrec: Change-based identification of move method refactoring opportunities, in: M. Pinzger, G. Bavota, A. Marcus (Eds.), IEEE 24th International Conference on Software Analysis, Evolution and Reengineering, SANER 2017, Klagenfurt, Austria, February 20-24, 2017, IEEE Computer Society, pp. 482–486 (2017). https://doi.org/10.1109/SANER.2017.7884658

  • Wang, X., Wang, Y.: The objective relation analysis method for multiobjective decision making and analysis. Syst. Eng. Theory Pract. 20(12), 63–66 (2000). https://doi.org/10.12011/1000-6788(2000)12-63

  • Xerces-j: (2022). http://xerces.apache.org/xerces-j/

  • Zanetti, M.S., Tessone, C.J., Scholtes, I., Schweitzer, F.: Automated software remodularization based on move refactoring: a complex systems approach, in: W. Binder, E. Ernst, A. Peternier, R. Hirschfeld (Eds.), 13th International Conference on Modularity, MODULARITY ’14, Lugano, Switzerland, April 22-26, ACM, 2014, pp. 73–84 (2014). https://doi.org/10.1145/2577080.2577097

  • Zhang, Y., Dong, C., Liu, H., Ge, C.: Code smell detection approach based on pre-training model and multi-level information. J. Softw. 005, 033 (2022a)

    Google Scholar 

  • Zhang, Y., Ge, C., Hong, S., Tian, R., Dong, C., Liu, J.: Delesmell: Code smell detection based on deep learning and latent semantic analysis. Knowl. Based Syst. 255, 109737 (2022b). https://doi.org/10.1016/j.knosys.2022.109737

    Article  Google Scholar 

  • Zhao, Y., Yang, Y., Zhou, Y., Ding, Z.: DEPICTER: a design-principle guided and heuristic-rule constrained software refactoring approach. IEEE Trans. Reliab. 71(2), 698–715 (2022). https://doi.org/10.1109/TR.2022.3159851

    Article  Google Scholar 

Download references

Acknowledgements

The authors would like to thank the insightful comments and suggestions of those anonymous reviewers, which have improved the presentation. This work is partially supported by the Hebei Natural Science Foundation under Grant No.F2023208001, the Hebei Oversea High-level Talent Foundation under Grant No.C20230358, and the Hebei Graduate Innovation Project under Grant No. CXZZSS2022081.

Author information

Authors and Affiliations

Authors

Contributions

Y.Z.: Proposing the idea, experimental analysis, writing—review & editing. K.G.: conducting experimentation, writing—original draft, review & editing. L.F.: conducting experimentation, methodology, writing—original draft.

Corresponding authors

Correspondence to Yang Zhang or Lining Fang.

Ethics declarations

Competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zhang, Y., Guan, K. & Fang, L. MIRROR: multi-objective refactoring recommendation via correlation analysis. Autom Softw Eng 31, 2 (2024). https://doi.org/10.1007/s10515-023-00400-1

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10515-023-00400-1

Keywords

Navigation