Abstract
Refactoring is the de-facto practice to optimize software health. While several studies propose refactoring strategies to optimize software design through applying design patterns and removing design defects, little is known about how developers actually refactor their code to improve its reuse. Therefore, we extract, from 1,828 open source projects, a set of refactorings that were intended to improve the software reusability. We analyze the impact of reusability refactorings on the state-of-the-art reusability metrics, and we compare the distribution of reusability refactoring types, with the distribution of the remaining mainstream refactorings. Overall, we found that the distribution of refactoring types, applied in the context of reusability, is different from the distribution of refactoring types in mainstream development. In the refactorings performed to improve reusability, source files are subject to more design level types of refactorings. Reusability refactorings significantly impact, high-level code elements, such as packages, classes, and methods, while typical refactorings, impact all code elements, including identifiers, and parameters. These findings provide practical insights into the current practice of refactoring in the context of code reuse involving the act of refactoring.
Similar content being viewed by others
Notes
Regular expression was used to capture all expansions of reus such as reuses, reusing, reuse, etc.
https://github.com/modelmapper/modelmapper/commit/ 6796071fc6ad98150b6faf654c8200164f977aa4
Full file path: LiveGithubRepository.java/TokenRepository.java/LiveWikiRepository.java
Ful file path: GithubApi.java/TokenApi.java/WikiApi.java
References
stream-lib (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/1.html. Accessed 23 Dec 2021
FluentLenium (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/2.html. Accessed 23 Dec 2021
d4rken (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/3.html. Accessed 23 Dec 2021
JetBrains (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/4.html. Accessed 23 Dec 2021
jline (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/5.html. Accessed 23 Dec 2021
buddycloud (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/6.html. Accessed 23 Dec 2021
dustin (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/7.html. Accessed 23 Dec 2021
dekellum (2021) GitHub archived web page. https://smilevo.github.io/self-affirmed-refactoring/Data/8.html. Accessed 23 Dec 2021
Abdalkareem R, Shihab E, Rilling J (2017) On code reuse from stackoverflow: an exploratory study on android apps. Inf Softw Technol 88:148–158
Ahmaro I, Abualkishik A, Yusof M (2014) Taxonomy, definition, approaches, benefits, reusability levels, factors and adaption of software reusability: a review of the research literature. J Appl Sci. 14
AlOmar EA, Barinas D, Liu J, Mkaouer MW, Ouni A, Newman C (2020) An exploratory study on how software reuse is discussed in stack overflow. In: International Conference on Software and Software Reuse, pp. 292–303. Springer
AlOmar EA, Mkaouer MW, Newman C, Ouni A (2021) On preserving the behavior in software refactoring: a systematic map** study. Information and Software Technology p, p 106675
AlOmar EA, Mkaouer MW, Ouni A (2019). Can refactoring be self-affirmed? an exploratory study on how developers document their refactoring activities in commit messages. In: 2019 IEEE/ACM 3rd International Workshop on Refactoring (IWoR), pp. 51–58. IEEE
AlOmar EA, Mkaouer MW, Ouni A (2021) Toward the automatic classification of self-affirmed refactoring. J Syst Softw 171:110821. https://doi.org/10.1016/j.jss.2020.110821
AlOmar EA, Mkaouer MW, Ouni A, Kessentini M (2019). On the impact of refactoring on the relationship between quality attributes and design metrics. In: 2019 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), pp. 1–11. IEEE
AlOmar EA, Peruma A, Mkaouer MW, Newman C, Ouni A, Kessentini, M (2020). How we refactor and how we document it? on the use of supervised machine learning algorithms to classify refactoring documentation. Expert Systems with Applications p. 114176
AlOmar EA, Rodriguez PT, Bowman J, Wang T, Adepoju B, Lopez K, Newman C, Ouni A, Mkaouer MW (2020) How do developers refactor code to improve code reusability? In: International Conference on Software and Software Reuse, pp. 261–276. Springer
Alshayeb M (2009) Empirical investigation of refactoring effect on software quality. Inf softw Technol 51(9):1319–1326
An L, Mlouki O, Khomh F, Antoniol G (2017) Stack overflow:a code laundering platform? In: 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 283–293. IEEE
Anguswamy R, Frakes WB (2012) A study of reusability, complexity, and reuse design principles. In: Proceedings of the ACM-IEEE International Symposium on Empirical Software Engineering and Measurement, ESEM ’12, p. 161’164. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/2372251.2372280
Baqais AAB, Alshayeb M (2020) Automatic software refactoring: a systematic literature review. Softw Qual J 28(2):459–502
Bavota G, De Lucia A, Di Penta M, Oliveto R, Palomba F (2015) An experimental investigation on the innate relationship between quality and refactoring. J Syst Softw 107:1–14
Bavota G, Dit B, Oliveto R, Di Penta M, Poshyvanyk D, De Lucia A (2013). An empirical study on the developers’ perception of software coupling. In: Proceedings of the 2013 International Conference on Software Engineering, pp. 692–701. IEEE Press
Cedrim D, Sousa L, Garcia A, Gheyi, R.:ACM, (2016) Does refactoring improve software structural quality? a longitudinal study of 25 projects. In: Proceedings of the 30th Brazilian Symposium on Software Engineering, pp. 73–82. ACM
Chávez A, Ferreira I, Fernandes E, Cedrim D, Garcia, A (2017). ACM, How does refactoring affect internal quality attributes?: A multi-project study. In: Proceedings of the 31st Brazilian Symposium on Software Engineering, pp. 74–83. ACM
Chidamber SR, Kemerer CF (1994) A metrics suite for object oriented design. IEEE Trans Softw Eng 20(6):476–493
Dig D, Johnson R (2005). The role of refactorings in api evolution. In: 21st IEEE International Conference on Software Maintenance (ICSM’05), pp. 389–398. IEEE
Du Bois B, 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
Fakhoury S, Roy D, Hassan A, Arnaoudova V (2019). Improving source code readability: theory and practice. In: 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC), pp. 2–12. IEEE
Feitosa D, Ampatzoglou A, Gkortzis A, Bibi S, Chatzigeorgiou A (2020) Code reuse in practice: benefiting or harming technical debt. J Syst Softw 167:110618. https://doi.org/10.1016/j.jss.2020.110618
Fernandes E, Chávez A, Garcia A, Ferreira I, Cedrim D, Sousa L, Oizumi W (2020) Refactoring effect on internal quality attributes: what haven’t they told you yet? Inf Softw Technol. 126:106347
Fowler M (2018) Refactoring: improving the design of existing code. Addison-Wesley Professional
Gamma E, Helm R, Johnson R, Vlissides J, Patterns D (1995) Elements of reusable object-oriented software. Addison-Wesley Publishing Company, Design Patterns. massachusetts
Ghofrani J, Kozegar E, Bozorgmehr A, Soorati MD (2019). Reusability in artificial neural networks: An empirical study. In: Proceedings of the 23rd International Systems and Software Product Line Conference - Volume B, SPLC ’19, p. 122’129. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/3307630.3342419
Hamdi O, Ouni A, AlOmar EA, Cinnéide MÓ, Mkaouer MW (2021) An empirical study on the impact of refactoring on quality metrics in android applications. In: 2021 IEEE/ACM 8th International Conference on Mobile Software Engineering and Systems (MobileSoft), pp. 28–39. IEEE
Hegedűs G, Hrabovszki G, Hegedűs D, Siket, I.:ACM, (2010) Effect of object oriented refactorings on testability, error proneness and other maintainability attributes. In: Proceedings of the 1st Workshop on Testing Object-Oriented Systems, p. 8. ACM (2010)
Hotta K, Sano Y, Higo Y, Kusumoto S (2010) Is duplicate code more frequently modified than non-duplicate code in software evolution? an empirical study on open source software. In: Proceedings of the Joint ERCIM Workshop on Software Evolution (EVOL) and International Workshop on Principles of Software Evolution (IWPSE), pp. 73–82
Jones B, Litvintchouk S, Mungle J, Krasner H, Mellby J, Willman H (1985) Issues in software reusability. Ada Lett. Doi: https://doi.org/10.1145/1041339.1041345
Kerievsky J (2005) Refactoring to patterns. Pearson Deutschland GmbH
Leitch R, Stroulia E (2003) Assessing the maintainability benefits of design restructuring using dependency analysis. In: Proceedings. 5th International Workshop on Enterprise Networking and Computing in Healthcare Industry (IEEE Cat. No. 03EX717), pp. 309–322. IEEE
Lorenz M, Kidd J (1994) Object-oriented software metrics, vol 131. Prentice Hall Englewood Cliffs
Lotter A, Licorish SA, Savarimuthu BTR, Meldrum S (2018). Code reuse in stack overflow and popular open source java projects. In: 2018 25th Australasian Software Engineering Conference (ASWEC), pp. 141–150. IEEE
Lubars MD (1986) Code reusability in the large versus code reusability in the small. SIGSOFT Softw Eng. Doi: https://doi.org/10.1145/382300.382307
Makady S, Walker RJ (2017) Test code reuse from oss: Current and future challenges. In: Proceedings of the 3rd Africa and Middle East Conference on Software Engineering, AMECSE ’17, p. 31’36. Association for Computing Machinery, New York, NY, USA . https://doi.org/10.1145/3178298.3178305
McCabe TJ (1976) A complexity measure. IEEE Trans Softw Eng 4:308–320
Mkaouer MW, Kessentini M, Bechikh S, Cinnéide MÓ, Deb K (2016) On the use of many quality attributes for software refactoring: a many-objective search-based software engineering approach. Emp Softw Eng 21(6):2503–2545
Mockus A (2007). Large-scale code reuse in open source software. In: Proceedings of the First International Workshop on Emerging Trends in FLOSS Research and Development, FLOSS ’07, p. 7. IEEE Computer Society, USA. 10.1109/FLOSS.2007.10. https://doi.org/10.1109/FLOSS.2007.10
Mondal M, Rahman MS, Saha RK, Roy CK, Krinke J, Schneider KA (2011). A complexity measure. IEEE Trans Softw Eng (4), 308–320
Moser R, Abrahamsson P, Pedrycz W, Sillitti A, Succi G (2007). A case study on the impact of refactoring on quality and productivity in an agile team. In: IFIP Central and East European Conference on Software Engineering Techniques, pp. 252–266. Springer
Moser R, Sillitti A, Abrahamsson P, Succi G (2006). Does refactoring improve reusability? In: International Conference on Software Reuse, pp. 287–297. Springer
Munaiah N, Kroh S, Cabrey C, Nagappan M (2017) Curating github for engineered software projects. Emp Softw Eng 22(6):3219–3253
Murphy-Hill E, Parnin C, Black AP (2012) How we refactor, and how we know it. IEEE Trans Softw Eng 38(1):5–18
Opdyke WF (1992) Refactoring object-oriented frameworks
Paixão M, Uchôa A, Bibiano AC, Oliveira D, Garcia A, Krinke J, Arvonio E (2020) 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, pp. 125–136
Pantiuchina J, Lanza M, Bavota G (2018). Improving code: the (mis) perception of quality metrics. In: 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 80–91. IEEE
Patrick MT (2020) Exploring software reusability metrics with q&a forum data. J Syst Softw. 168:110652
Patwa S, Malviya AK (2012) Reusability metrics and effect of reusability on testing of object oriented systems. SIGSOFT Softw Eng. Doi: https://doi.org/10.1145/2347696.2347708
Peruma A, Mkaouer MW, Decker MJ, Newman CD (2020) Contextualizing rename decisions using refactorings, commit messages, and data types. J Syst Softw
Peruma A, Newman CD, Mkaouer MW, Ouni A, Palomba F (2020) Contextualizing rename decisions using refactorings, commit messages, and data types. J Syst Softw. p. 110704
Quan L, Zongyan Q, Liu Z (2008) Formal use of design patterns and refactoring. In: International Symposium on Leveraging Applications of Formal Methods, Verification and Validation, pp. 323–338. Springer
Robson C (2002) Real world research: a resource for social scientists and practitioner-researchers. Wiley-Blackwell
Roy CK, Zibran MF, Koschke R (2014) The vision of software clone management: Past, present, and future (keynote paper). In: 2014 Software Evolution Week-IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE), pp. 18–33. IEEE
Runeson P, Höst M (2009) Guidelines for conducting and reporting case study research in software engineering. Emp Softw Eng 14(2):131–164
Sahraoui HA, Godin R, Miceli T (2000) Can metrics help to bridge the gap between the improvement of oo design quality and its automation? In: icsm. IEEE, p 154
Sharma A, Grover PS, Kumar R (2009) Reusability assessment for software components. SIGSOFT Softw Eng. Notes 34(2):1’6
Sharma A, Kumar R, Grover P (2007) A critical survey of reusability aspects for component-based systems. World Acad Sci Eng Technol 19:411–415
Shatnawi R, Li W (2011) An empirical assessment of refactoring impact on software quality using a hierarchical quality model. Int J Softw Eng Appl 5(4):127–149
Stroggylos K, Spinellis D (2007) Refactoring–does it improve software quality? In: Fifth International Workshop on Software Quality (WoSQ’07: ICSE Workshops 2007), pp. 10–10. IEEE
Stroulia E, Kapoor R (2001) Metrics of refactoring-based development: an experience report. In: OOIS 2001, pp. 113–122. Springer
Szóke G, Antal G, Nagy C, Ferenc R, Gyimóthy T (2014). Bulk fixing coding issues and its effects on software quality: Is it worth refactoring? In: 2014 IEEE 14th International Working Conference on Source Code Analysis and Manipulation, pp. 95–104. IEEE
Tahvildari L, Kontogiannis K (2003) A metric-based approach to enhance design quality through meta-pattern transformations. In: Seventh European Conference onSoftware Maintenance and Reengineering, 2003. Proceedings., pp. 183–192. IEEE
Tahvildari L, Kontogiannis K, Mylopoulos J (2003) Quality-driven software re-engineering. J Syst Softw 66(3):225–239
Tsantalis N, Mansouri M, Eshkevari LM, Mazinanian D, Dig, D (2018) Accurate and efficient refactoring detection in commit history. In: Proceedings of the 40th International Conference on Software Engineering, pp. 483–494. ACM
Wilcoxon F (1945) Individual comparisons by ranking methods. Biomet Bullet 1(6):80–83
Wilking D, Kahn UF, Kowalewski S (2007) An empirical evaluation of refactoring. e-Informatica 1(1):27–42
Wohlin C, Runeson P, Host M, Ohlsson M, Regnell B, Wesslen A (2000) Experimentation in software engineering: an introduction
Yin, W, Tanik MM, Yun DYY, Lee TJ, Dale AG (1987) Software reusability: a survey and a reusability experiment. In: Proceedings of the 1987 Fall Joint Computer Conference on Exploring Technology: Today and Tomorrow, ACM ’87, p. 65’72. IEEE Computer Society Press, Washington, DC, USA
Younoussi S, Roudies O (2015) All about software reusability: a systematic literature review. J Theoret Appl Inf Technol 76:64–75
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Alomar, E.A., Wang, T., Raut, V. et al. Refactoring for reuse: an empirical study. Innovations Syst Softw Eng 18, 105–135 (2022). https://doi.org/10.1007/s11334-021-00422-6
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11334-021-00422-6