Skip to main content

How Do Developers Refactor Code to Improve Code Reusability?

  • Conference paper
  • First Online:
Reuse in Emerging Software Engineering Practices (ICSR 2020)

Abstract

Refactoring is the de-facto practice to optimize software health. While there has been several studies proposing 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 which were intended to improve the software reusability. We analyze the impact of reusability refactorings on 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.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://smilevo.github.io/self-affirmed-refactoring/.

  2. 2.

    https://smilevo.github.io/self-affirmed-refactoring/.

  3. 3.

    https://scitools.com/.

  4. 4.

    Regular expression was used to capture all expansions of reus such as reuses, reusing, reuse, etc.

  5. 5.

    Link to the commit: https://github.com/modelmapper/modelmapper/commit/6796071fc6ad98150b6faf654c8200164f977aa4.

  6. 6.

    https://scitools.com/features/.

References

  1. AlOmar, E., Mkaouer, M.W., Ouni, A.: 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 (2019)

    Google Scholar 

  2. AlOmar, E.A., Mkaouer, M.W., Ouni, A.: Toward the automatic classification of self-affirmed refactoring. J. Syst. Softw. 171, 110821 (2020)

    Article  Google Scholar 

  3. AlOmar, E.A., Mkaouer, M.W., Ouni, A., Kessentini, M.: 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 (2019)

    Google Scholar 

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

    Article  Google Scholar 

  5. Chidamber, S.R., Kemerer, C.F.: A metrics suite for object oriented design. IEEE Trans. Softw. Eng. 20(6), 476–493 (1994)

    Article  Google Scholar 

  6. Fakhoury, S., Roy, D., Hassan, A., Arnaoudova, V.: Improving source code readability: theory and practice. In: 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC), pp. 2–12. IEEE (2019)

    Google Scholar 

  7. Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, Boston (2018)

    MATH  Google Scholar 

  8. Lorenz, M., Kidd, J.: Object-Oriented Software Metrics, vol. 131. Prentice Hall, Englewood Cliffs (1994)

    Google Scholar 

  9. McCabe, T.J.: A complexity measure. IEEE Trans. Softw. Eng. 4, 308–320 (1976)

    Article  MathSciNet  Google Scholar 

  10. Moser, R., Sillitti, A., Abrahamsson, P., Succi, G.: Does refactoring improve reusability? In: Morisio, M. (ed.) ICSR 2006. LNCS, vol. 4039, pp. 287–297. Springer, Heidelberg (2006). https://doi.org/10.1007/11763864_21

    Chapter  Google Scholar 

  11. Munaiah, N., Kroh, S., Cabrey, C., Nagappan, M.: Curating GitHub for engineered software projects. Empirical Softw. Eng. 22(6), 3219–3253 (2017). https://doi.org/10.1007/s10664-017-9512-6

    Article  Google Scholar 

  12. Murphy-Hill, E., Parnin, C., Black, A.P.: How we refactor, and how we know it. IEEE Trans. Softw. Eng. 38(1), 5–18 (2012)

    Article  Google Scholar 

  13. Opdyke, W.F.: Refactoring object-oriented frameworks (1992)

    Google Scholar 

  14. Pantiuchina, J., Lanza, M., Bavota, G.: Improving code: the (mis) perception of quality metrics. In: 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 80–91. IEEE (2018)

    Google Scholar 

  15. Peruma, A., Mkaouer, M.W., Decker, M.J., Newman, C.D.: Contextualizing rename decisions using refactorings, commit messages, and data types. J. Syst. Softw. 169, 110704 (2020)

    Article  Google Scholar 

  16. Peruma, A., Newman, C.D., Mkaouer, M.W., Ouni, A., Palomba, F.: An exploratory study on the refactoring of unit test files in android applications. In: Conference on Software Engineering Workshops, ICSEW 2020 (2020)

    Google Scholar 

  17. Sharma, A., Kumar, R., Grover, P.: A critical survey of reusability aspects for component-based systems. World Acad. Sci. Eng. Technol. 19, 411–415 (2007)

    Google Scholar 

  18. Stroggylos, K., Spinellis, D.: Refactoring-does it improve software quality? In: Fifth International Workshop on Software Quality (WoSQ 2007: ICSE Workshops 2007), p. 10. IEEE (2007)

    Google Scholar 

  19. Tsantalis, N., Mansouri, M., Eshkevari, L.M., Mazinanian, D., Dig, D.: Accurate and efficient refactoring detection in commit history. In: Proceedings of the 40th International Conference on Software Engineering, pp. 483–494. ACM (2018)

    Google Scholar 

  20. Wilcoxon, F.: Individual comparisons by ranking methods. Biom. Bull. 1(6), 80–83 (1945)

    Article  Google Scholar 

Download references

Acknowledgements

This material is based on work supported by the National Science Foundation under Grant No. 1757680.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Eman Abdullah AlOmar .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

AlOmar, E.A. et al. (2020). How Do Developers Refactor Code to Improve Code Reusability?. In: Ben Sassi, S., Ducasse, S., Mili, H. (eds) Reuse in Emerging Software Engineering Practices. ICSR 2020. Lecture Notes in Computer Science(), vol 12541. Springer, Cham. https://doi.org/10.1007/978-3-030-64694-3_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-64694-3_16

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-64693-6

  • Online ISBN: 978-3-030-64694-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics