Skip to main content
Log in

A metrics-based approach for selecting among various refactoring candidates

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

Abstract

Refactoring is the most prominent way of repaying Technical Debt and improving software maintainability. Despite the acknowledgement of refactorings as a state-of-practice technique (both by industry and academia), refactoring-based quality optimizations are debatable due to three important concerns: (a) the impact of a refactoring on quality is not always positive; (b) the list of available refactoring candidates is usually vast, restricting developers from applying all suggestions; and (c) there is no empirical evidence on which parameters are related to positive refactoring impact on quality. To alleviate these concerns, we reuse a benchmark (constructed in a previous study) of real-world refactorings having either a positive or negative impact on quality; and we explore the parameters (structural characteristics of classes) affecting the impact of the refactoring. Based on the findings, we propose a metrics-based approach for guiding practitioners on how to prioritize refactoring candidates. The results of the study suggest that classes with high coupling and large size should be given priority, since they tend to have a positive impact on technical debt.

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

Similar content being viewed by others

Data Availability

The dataset generated and analyzed during the current study is available online.

Notes

  1. https://github.com/nikosnikolaidis/github-pr-labels-filechanges

  2. https://github.com/dimizisis/metrics_calculator

  3. https://users.uom.gr/~a.ampatzoglou/aux_material/refactoring_preds.xlsx

  4. https://github.com/apache/pinot/commit/7d09489c5b939666c0561b6301c9287ef34ea239

References

  • AlOmar EA, Mkaouer MW, Ouni A, Kessentini M (2019) On the Impact of Refactoring on the Relationship between Quality Attributes and Design Metrics, 2019 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), Porto de Galinhas, Brazil, pp. 1-11

  • Alshayeb M (2009) Empirical investigation of refactoring effect on software quality. Inf Softw Technol 51(9):1319–1326

    Article  Google Scholar 

  • Alves NSR, Mendes TS, de Mendonça MG, Spínola RO, Shull F, Seaman C (2016) Identification and management of technical debt: A systematic mapping study. Inf Softw Technol 70:100–121 (Elsevier)

    Article  Google Scholar 

  • Alves NSR, Mendes TS, Mendonca MGd, Spınola RO, Shull F, Seaman C (2016) Identification and management of technical debt: A systematic mapping study. Inf Softw Technol 70:100–121

    Article  Google Scholar 

  • Ampatzoglou A, Ampatzoglou A, Chatzigeorgiou A, Avgeriou P (2015a) The financial aspect of managing technical debt: A systematic literature review. Inf Softw Technol. 64:52–73

    Article  Google Scholar 

  • Ampatzoglou A, Ampatzoglou A, Avgeriou P, Chatzigeorgiou A (2015b) “Establishing a framework for managing interest in technical debt” in 5th International Symposium on Business Modeling and Software Design (BMSD), Italy

  • Ampatzoglou AA, Ampatzoglou A, Avgeriou P, Chatzigeorgiou A (2016) A Financial Approach for Managing Interest in Technical Debt, 2015 International Symposium on Business Modeling and Software Design (BMSD). Springer

  • Ampatzoglou, Michailidis A, Sarikyriakidis C, Ampatzoglou A, Chatzigeorgiou A, Avgeriou P (2018) A framework for managing interest in technical debt: an industrial validation, in Proceedings of the 2018 International Conference on Technical Debt, pp. 115–124

  • Ampatzoglou A, Tsintzira AA, Arvanitou EM, Chatzigeorgiou A, Stamelos I, Moga A, Heb R, Matei O, Tsiridis N, Kehagias D (2019) Applying the Single Responsibility Principle in Industry: Modularity Benefits and Trade-offs, 23rd International Conference on the Evaluation and Assessment in Software Engineering (EASE' 19), ACM, Copenhagen, Denmark, 14–17

  • Ampatzoglou A, Mittas N, Tsintzira AA, Ampatzoglou A, Arvanitou EM, Chatzigeorgiou A, Avgeriou P, Angelis L (2020) Exploring the relation between technical debt principal and interest: an empirical approach. Inform Software Technol 128:106391. https://doi.org/10.1016/j.infsof.2020.106391

  • Arvanitou EM, Ampatzoglou A, Chatzigeorgiou A, Avgeriou P (2016) Software Metrics Fluctuation: A Prop-erty for Assisting the Metric Selection Process. Inf Softw Technol 72(4):110–124 (Elsevier)

    Article  Google Scholar 

  • Arvanitou EM, Argyriadou P, Koutsou G, Ampatzoglou A, Chatzigeorgiou A. "Quantifying TD Interest: Are we Getting Closer, or Not Even That?", 48th Euromicro Conference on Software Engineering and Advanced Applications (SEAA' 22), IEEE Computer Society, August 2020, Gran Canaria, Spain

  • Avgeriou P, Taibi D, Ampatzoglou A, Arcelli Fontana F, Besker T, Chatzigeorgiou A, Lenarduzzi V, Martini A, Moschou N, Pigazzini I, Saarimäki N, Sas D, Soares de Toledo S, Tsintzira A (2021) An overview and comparison of technical debt measurement tools. Journals and Magazines: IEEE Software 38(3):61–71. https://doi.org/10.1109/MS.2020.3024958

    Article  Google Scholar 

  • Calefato F, Lanubile F, Novielli N (2017) A Preliminary Analysis on the Effects of Propensity to Trust in Distributed Software Development, 2017 IEEE 12th International Conference on Global Software Engineering (ICGSE), Buenos Aires, Argentina, pp. 56–60

  • Campbell GA, Papapetrou PP (2013) SonarQube in action. Manning Publications. https://www.amazon.com/SonarQube-Action-G-Ann-Campbell/dp/1617290955

  • Chaparro O, Bavota G, Marcus A, Penta MD (2014) On the Impact of Refactoring Operations on Code Quality Metrics, 2014 IEEE International Conference on Software Maintenance and Evolution, Victoria, BC, Canada, pp. 456–460

  • Charalampidou S, Ampatzoglou A, Chatzigeorgiou A, Gkortzis A, Avgeriou P (2016) Identifying extract method refactoring opportunities based on functional relevance. IEEE Trans Software Eng 43(10):954–974

    Article  Google Scholar 

  • Chatzigeorgiou, Ampatzoglou A, Ampatzoglou A, Amanatidis T (2015) Estimating the breaking point for technical debt, 2015 IEEE 7th International Workshop on Managing Technical Debt (MTD), Bremen, Germany, pp. 53-56

  • Digkas G, Chatzigeorgiou A, Ampatzoglou A, Avgeriou P (2022) Can Clean New Code Reduce Technical Debt Density? IEEE Computer Society, Transactions on Software Engineering

    Book  Google Scholar 

  • Du Bois B and Mens T (2003) Describing the impact of refactoring on internal program quality, in International Workshop on Evolution of Large-scale Industrial Software Applications, pp. 37–48

  • Eisenberg RJ (2012) A threshold-based approach to technical debt. SIGSOFT Softw Eng Notes 37:1–6

    Article  Google Scholar 

  • Falessi D, Rusfso B, Mullen K (2017) What if i had no smells? in 2017 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM). IEEE, pp. 78–84

  • Falessi D, Russo B, Mullen K (2017) What if I Had No Smells? 2017 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), Toronto, ON, Canada, 2017, pp. 78-84

  • Fowler M, Beck K (1999) “Refactoring: improving the design of existing code”, ser. Addison-Wesley, In Addison Wesley object technology series

    Google Scholar 

  • Fowler M, Beck K, Brant J, Opdyke W, Roberts D (1999) Refactoring: Improving the Design of Existing Code, Addison-Wesley Professional, 1st Edition

  • Ge X, DuBose QL, Murphy-Hill E (2012) Reconciling manual and automatic refactoring," 2012 34th International Conference on Software Engineering (ICSE), Zurich, Switzerland, pp. 211–221

  • Gousios G, Zaidman A, Storey M-A and Deursen AV (2015) Work Practices and Challenges in Pull-Based Development: The Integrator's Perspective, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering, Florence, Italy, pp. 358–368

  • Hastings T and Walcott KR (2022) Continuous Verification of Open-Source Components in a World of Weak Links, 2022 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW), Charlotte, NC, USA, pp. 201-207

  • Higo Y, Matsumoto Y, Kusumoto S, Inoue K (2008) Refactoring Effect Estimation Based on Complexity Metrics, 19th Australian Conference on Software Engineering (aswec 2008), Perth, WA, Australia, pp. 219–228

  • Ichtsis A, Mittas N, Ampatzoglou A, Chatzigeorgiou A (2022) Merging Smell Detec-tors: Evidence on the Agreement of Multiple Tools, 2022 IEEE/ACM International Conference on Technical Debt (TechDebt), Pittsburgh, PA, USA, pp. 61–65

  • Ivers J, Nord RL, Ozkaya I, Seifried C, Timperley CS, Kessentini M (2022) Industry experiences with large-scale refactoring, 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, USA, Nov. pp. 1544–1554

  • Karmakar S, Codabux Z, Vidoni M (2022) An Experience Report on Technical Debt in Pull Requests: Challenges and Lessons Learned, 16th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, pp. 295–300

  • Kataoka Y, Imai T, Andou H, Fukaya T (2002) A quantitative evaluation of maintainability enhancement by refactoring, International Conference on Software Maintenance, pp. 576–585

  • Kataoka Y, Imai T, Andou H, Fukaya T (2002) A quantitative evaluation of maintainability enhancement by refactoring, International Conference on Software Maintenance, 2002. Proceedings., Montreal, QC, Canada, pp. 576–585

  • Kitchenham B, Pfleeger SL (1996) Software quality: the elusive target [special issues section]. IEEE Softw 13(1):12–21

    Article  Google Scholar 

  • Kurbatova Z, Veselov I, Golubev Y, Bryksin T (2020) June. Recommendation of move method refactoring using path-based representation of code. In Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops (pp. 315–322)

  • Lefever J, Cai Y, Cervantes H, Kazman R, Fang H (2021) On the lack of consensus among technical debt detection tools. International Conference on Software Engineering (SEIP); 121–130

  • Lehman MM, Ramil JF, Wernick PD, Perry DE, Turski WM (1997)Metrics and laws of software evolution-the nineties view. In: Proceedings fourth international software metrics symposium. IEEE, Albuquerque, NM, USA, pp 20–32. https://doi.org/10.1109/METRIC.1997.637156

  • Lenarduzzi V, Nikkola V, Saarimäki N, Taibi D (2021) Does code quality affect pull request acceptance? An empirical study. J Syst Softw 171:110806

    Article  Google Scholar 

  • Letouzey J-L (2012) The sqale method for evaluating technical debt, in 2012 Third International Workshop on Managing Technical Debt (MTD). IEEE, pp. 31–36

  • Li Z, Avgeriou P, Liang P (2015) A systematic mapping study on technical debt and its management. J Syst Softw 101:193–220

    Article  Google Scholar 

  • Martini A, Besker T, Bosch J (2018) Technical debt tracking: Current state of practice: A survey and multiple case study in 15 large organizations. Sci Comput Program 163:42–61

    Article  Google Scholar 

  • Mavridis A, Ampatzoglou A, Stamelos I, Sfetsos P, Deligiannis I (2012) Selecting refactorings: an option based approach. In 2012 Eighth International Conference on the Quality of Information and Communications Technology (pp. 272–277). IEEE.

  • Meananeatra P, Rongviriyapanish S, Apiwattanapong T (2011) Using software metrics to select refactoring for long method bad smell. 8th Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI) Association of Thailand-Conference 2011 (pp. 492–495). IEEE

  • Moreira Soares D, de Lima Júnior ML, Murta L, Plastino A (2021) What factors influence the lifetime of pull requests. Softw Pract Exp 51(6):1173–1193

    Article  Google Scholar 

  • Moser R, Abrahamsson P, Pedrycz W, Sillitti A, Succi G (2008) A Case Study on the Impact of Refactoring on Quality and Productivity in an Agile Team, in Balancing Agility and Formalism in Software Engineering, Meyer B, Nawrocki JR, Walter B, Eds., in Lecture Notes in Computer Science. Berlin, Heidelberg: Springer, pp. 252–266

  • Murphy-Hill E, Parnin C, Black AP (2011) How we refactor, and how we know it. IEEE Trans Software Eng 38(1):5–18

    Article  Google Scholar 

  • Murphy-Hill E, Black AP (2008) Breaking the barriers to successful refactoring: observations and tools for extract method. In Proceedings of the 30th international conference on Software engineering (pp. 421–430)

  • Nikolaidis N, Zisis D, Ampatzoglou A, Mittas N, Chatzigeorgiou A (2022) Using Machine Learning to Guide the Application of Software Refactorings: A Preliminary Exploration, 6th International Workshop on Machine Learning Techniques for Software Quality Evolution (Maltesque '22), ACM

  • Nikolaidis N, Ampatzoglou A, Chatzigeorgiou A, Mittas N, Konstantinidis E, Bamidis P (2023) Exploring the Effect of Various Maintenance Activities on the Accumulation of TD Principal, 6th International Conference on Technical Debt (TechDEBT' 23), Melbourne, Australia

  • Nikolaidis N, Mittas N, Ampatzoglou A, Arvanitou EM, Chatzigeorgiou A (2023) Assessing TD Macro-Management: A Nested Modelling Statistical Approach. Trans Softw Eng

  • Riaz M, Mendes E, Tempero E (2009b) “A systematic review of software maintainability prediction and metrics”, 3rd International Symposium on Empirical Software Engineering and Measurement. IEEE, Florida, USA, pp 367–377

    Google Scholar 

  • Riaz M, Mendes E, Tempero E (2009) A systematic review of software maintainability prediction and metrics, 2009 3rd International Symposium on Empirical Software Engineering and Measurement, Lake Buena Vista, FL, USA, pp. 367-377

  • Runeson P, Host M, Rainer A, Regnell B (2012) Case study research in software engineering: guidelines and examples. John Wiley & Sons. https://doi.org/10.1002/9781118181034

  • Schnappinger M, Osman MH, Pretschner A, Fietzke A (2019) Learning a classifier for prediction of maintainability based on static analysis tools Proceedings of the 27th International Conference on Program Comprehension, IEEE Press, pp. 243–248

  • Sharma T, Mishra P, Tiwari R (2016) “Designite: a software design quality assessment tool”, 1st International Workshop on Bringing Architectural Design Thinking into Developers’ Daily Activities. NY, USA, May, New York, pp 1–4

    Google Scholar 

  • Silva D and Valente MT (2017) Refdiff: detecting refactorings in version histories. 14th International Conference on Mining Software Repositories, pages 269–279. IEEE Press

  • Silva MCO, Valente MT, Terra R (2016) Does technical debt lead to the rejection of pull requests?, ArXiv Prepr. ArXiv160401450

  • Smiari P, Bibi S, Ampatzoglou A, Arvanitou E-M (2022) Refactoring embedded software: A study in healthcare domain. Inf Softw Technol 143:106760

    Article  Google Scholar 

  • Soetens QD, Demeyer S (2010) Studying the Effect of Refactorings: A Complexity Metrics Perspective, 2010 Seventh International Conference on the Quality of Information and Communications Technology, Porto, Portugal, pp. 313–318

  • Stroggylos K, Spinellis D (2007) “Refactoring–does it improve software quality?” in Fifth International Workshop on Software Quality (WoSQ’07: ICSE Workshops. IEEE 2007:10–10

    Google Scholar 

  • Stroulia E and Kapoor R (2001) Metrics of refactoring-based development: An experience report. In OOIS 2001, pages 113–122. Springer

  • Tsantalis N, Ketkar A, Dig D (2022) RefactoringMiner 2.0. IEEE Transact Software Eng 48(3):930–950. https://doi.org/10.1109/TSE.2020.3007722

    Article  Google Scholar 

  • Tsantalis N, Chaikalis T, Chatzigeorgiou A (2008) JDeodorant: Identification and Removal of Type-Checking Bad Smells, 2008 12th European Conference on Software Maintenance and Reengineering, Athens, Greece, pp. 329–331

  • Tsintzira A-A, Ampatzoglou A, Matei O, Ampatzoglou A, Chatzigeorgiou A, Heb R (2019) Technical debt quantification through metrics: an industrial validation, in 15th China-Europe International Symposium on software engineering education

  • Van Koten C, Gray AR (2006) An Application of Bayesian Network for Predicting Object-Oriented Software Maintainability. Inform Software Tech 48(1):59–67

    Article  Google Scholar 

  • Wilking D, Kahn UF, Kowalewski S (2007) An empirical evaluation of refactoring. e-Informatica 1(1):27–42

    Google Scholar 

  • Yli-Huumo J, Maglyas A, Smolander K (2016) How do software development teams manage technical debt?–An empirical study. J Syst Softw 120:195–218 (Elsevier)

    Article  Google Scholar 

  • Zhang X, Yu Y, Gousios G, Rastogi A (2023) Pull request decisions explained: an empirical overview. IEEE Transact Software Eng 49(2):849–871. https://doi.org/10.1109/TSE.2022.3165056

    Article  Google Scholar 

  • Zhou Y, Xu B (2008) Predicting the maintainability of open-source software using design metrics. Wuhan Univ J Nat Sci 13(1):14–20

    Article  Google Scholar 

  • Zou W, Xuan J, Xie X, Chen Z, Xu B (2019) How does code style inconsistency affect pull request integration? an exploratory study on 117 github projects, Empir Softw Eng. 24(6)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Apostolos Ampatzoglou.

Ethics declarations

Conflict of Interest

The authors declare that they have no conflict of interest.

Additional information

Communicated by: Bibi Stamatia, Maxime Cordy, Bowen Xu, Xiaofei Xie

Publisher's Note

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

Supplementary Information

Below is the link to the electronic supplementary material.

Supplementary file1 (PDF 147 KB)

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

Nikolaidis, N., Mittas, N., Ampatzoglou, A. et al. A metrics-based approach for selecting among various refactoring candidates. Empir Software Eng 29, 25 (2024). https://doi.org/10.1007/s10664-023-10412-w

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10664-023-10412-w

Keywords

Navigation