skip to main content
10.1145/2950290.2950305acmconferencesArticle/Chapter ViewAbstractPublication PagesfseConference Proceedingsconference-collections
research-article

Why we refactor? confessions of GitHub contributors

Published:01 November 2016Publication History

ABSTRACT

Refactoring is a widespread practice that helps developers to improve the maintainability and readability of their code. However, there is a limited number of studies empirically investigating the actual motivations behind specific refactoring operations applied by developers. To fill this gap, we monitored Java projects hosted on GitHub to detect recently applied refactorings, and asked the developers to explain the reasons behind their decision to refactor the code. By applying thematic analysis on the collected responses, we compiled a catalogue of 44 distinct motivations for 12 well-known refactoring types. We found that refactoring activity is mainly driven by changes in the requirements and much less by code smells. Extract Method is the most versatile refactoring operation serving 11 different purposes. Finally, we found evidence that the IDE used by the developers affects the adoption of automated refactoring tools.

References

  1. G. Bavota, A. De Lucia, A. Marcus, and R. Oliveto. Recommending refactoring operations in large software systems. In M. P. Robillard, W. Maalej, R. J. Walker, and T. Zimmermann, editors, Recommendation Systems in Software Engineering, pages 387–419. Springer Berlin Heidelberg, 2014.Google ScholarGoogle Scholar
  2. G. Bavota, A. De Lucia, and R. Oliveto. Identifying Extract Class refactoring opportunities using structural and semantic cohesion measures. J. Syst. Softw., 84(3):397–414, Mar. 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. G. Bavota, R. Oliveto, M. Gethers, D. Poshyvanyk, and A. De Lucia. Methodbook: Recommending Move Method refactorings via relational topic models. IEEE Trans. Softw. Eng., 40(7):671–694, July 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. K. Beck. Extreme Programming Explained: Embrace Change. Addison-Wesley, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. O. Chaparro, G. Bavota, A. Marcus, and M. Di Penta. On the impact of refactoring operations on code quality metrics. In Proceedings of the 2014 IEEE International Conference on Software Maintenance and Evolution, pages 456–460, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. D. S. Cruzes and T. Dyba. Recommended steps for thematic synthesis in software engineering. In Proceedings of the 2011 International Symposium on Empirical Software Engineering and Measurement, pages 275–284, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Dias, A. Bacchelli, G. Gousios, D. Cassou, and S. Ducasse. Untangling fine-grained code changes. In Proceedings of the 22nd IEEE International Conference on Software Analysis, Evolution, and Reengineering, pages 341–350, 2015.Google ScholarGoogle ScholarCross RefCross Ref
  8. B. Dit, M. Revelle, M. Gethers, and D. Poshyvanyk. Feature location in source code: a taxonomy and survey. Journal of Software: Evolution and Process, 25(1):53–95, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  9. B. Du Bois, S. Demeyer, and J. Verelst. Does the ”refactor to understand” reverse engineering pattern improve program comprehension? In Proceedings of the Ninth European Conference on Software Maintenance and Reengineering, pages 334–343, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, Boston, MA, USA, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. L. Hintze and R. D. Nelson. Violin plots: A box plot-density trace synergism. The American Statistician, 52(2):181–184, 1998.Google ScholarGoogle ScholarCross RefCross Ref
  12. K. Hotta, Y. Higo, and S. Kusumoto. Identifying, tailoring, and suggesting Form Template Method refactoring opportunities with program dependence graph. In Proceedings of the 16th European Conference on Software Maintenance and Reengineering, pages 53–62, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Kawrykow and M. P. Robillard. Non-essential changes in version histories. In Proceedings of the 33rd International Conference on Software Engineering, pages 351–360, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. M. Kim, D. Cai, and S. Kim. An empirical investigation into the role of api-level refactorings during software evolution. In Proceedings of the 33rd International Conference on Software Engineering, pages 151–160, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Kim, M. Gee, A. Loh, and N. Rachatasumrit. Ref-Finder: A refactoring reconstruction tool based on logic query templates. In Proceedings of the Eighteenth ACM SIGSOFT International Symposium on Foundations of Software Engineering, pages 371–372, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Kim, T. Zimmermann, and N. Nagappan. A field study of refactoring challenges and benefits. In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering, pages 50:1–50:11, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Kim, T. Zimmermann, and N. Nagappan. An empirical study of refactoring challenges and benefits at Microsoft. IEEE Trans. Softw. Eng., 40(7), July 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. N. Meng, L. Hua, M. Kim, and K. S. McKinley. Does automated refactoring obviate systematic editing? In Proceedings of the 37th International Conference on Software Engineering, May 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. T. Mens and T. Tourwe. A survey of software refactoring. IEEE Trans. Softw. Eng., 30(2):126–139, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. G. C. Murphy, M. Kersten, and L. Findlater. How are Java software developers using the Eclipse IDE? IEEE Software, 23(4):76–83, July 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. E. Murphy-Hill and A. P. Black. Breaking the barriers to successful refactoring: Observations and tools for Extract Method. In Proceedings of the 30th International Conference on Software Engineering, pages 421–430, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. E. Murphy-Hill, T. Zimmermann, C. Bird, and N. Nagappan. The design space of bug fixes and how developers navigate it. IEEE Transactions on Software Engineering, 41(1):65–81, Jan 2015.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. E. R. Murphy-Hill, C. Parnin, and A. P. Black. How we refactor, and how we know it. IEEE Trans. Softw. Eng., 38(1):5–18, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. Negara, N. Chen, M. Vakilian, R. E. Johnson, and D. Dig. A comparative study of manual and automated refactorings. In Proceedings of the 27th European Conference on Object-Oriented Programming (ECOOP), pages 552–576, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Negara, M. Codoban, D. Dig, and R. E. Johnson. Mining fine-grained code changes to detect unknown change patterns. In Proceedings of the 36th International Conference on Software Engineering, pages 803–813, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. W. F. Opdyke. Refactoring object-oriented frameworks. PhD thesis, University of Illinois at Urbana-Champaign, IL, USA, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. K. Prete, N. Rachatasumrit, N. Sudan, and M. Kim. Template-based reconstruction of complex refactorings. In Proceedings of the 2010 IEEE International Conference on Software Maintenance, pages 1–10, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. N. Rachatasumrit and M. Kim. An empirical investigation into the impact of refactoring on regression testing. In 28th IEEE International Conference on Software Maintenance, pages 357–366, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. V. Sales, R. Terra, L. Miranda, and M. Valente. Recommending Move Method refactorings using dependency sets. In Proceedings of the 20th Working Conference on Reverse Engineering, pages 232–241, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  30. D. Silva, R. Terra, and M. T. Valente. Recommending automated Extract Method refactorings. In Proceedings of the 22nd International Conference on Program Comprehension, pages 146–156, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. J. Singer, S. E. Sim, and T. C. Lethbridge. Guide to Advanced Empirical Software Engineering, chapter Software Engineering Data Collection for Field Studies, pages 9–34. Springer London, London, 2008.Google ScholarGoogle Scholar
  32. G. Soares, R. Gheyi, E. Murphy-Hill, and B. Johnson. Comparing approaches to analyze refactoring activity on software repositories. J. Syst. Softw., 86(4):1006–1022, Apr. 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. R. Tairas and J. Gray. Increasing clone maintenance support by unifying clone detection and refactoring activities. Inf. Softw. Technol., 54(12):1297–1307, Dec. 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. N. Tsantalis and A. Chatzigeorgiou. Identification of Move Method refactoring opportunities. IEEE Trans. Softw. Eng., 35(3):347–367, May 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. N. Tsantalis and A. Chatzigeorgiou. Identification of Extract Method refactoring opportunities for the decomposition of methods. J. Syst. Softw., 84(10):1757–1782, Oct. 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. N. Tsantalis, V. Guana, E. Stroulia, and A. Hindle. A multidimensional empirical study on refactoring activity. In Proceedings of the Conference of the Centre for Advanced Studies on Collaborative Research (CASCON), pages 132–146, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. N. Tsantalis, D. Mazinanian, and G. P. Krishnan. Assessing the refactorability of software clones. IEEE Trans. Softw. Eng., 41(11):1055–1090, Nov 2015.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. M. Vakilian, N. Chen, S. Negara, B. A. Rajkumar, B. P. Bailey, and R. E. Johnson. Use, disuse, and misuse of automated refactorings. In Proceedings of the 34th International Conference on Software Engineering, pages 233–243, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Y. Wang. What motivate software engineers to refactor source code? evidences from professional developers. In IEEE International Conference on Software Maintenance, pages 413–416, Sept 2009.Google ScholarGoogle ScholarCross RefCross Ref
  40. P. Weißgerber and S. Diehl. Are refactorings less error-prone than other changes? In Proceedings of the 2006 International Workshop on Mining Software Repositories, pages 112–118, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Z. Xing and E. Stroulia. UMLDiff: An algorithm for object-oriented design differencing. In Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering, pages 54–65, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Z. Xing and E. Stroulia. The JDEvAn tool suite in support of object-oriented evolutionary development. In Companion of the 30th International Conference on Software Engineering, pages 951–952, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Why we refactor? confessions of GitHub contributors

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          FSE 2016: Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering
          November 2016
          1156 pages
          ISBN:9781450342186
          DOI:10.1145/2950290

          Copyright © 2016 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 November 2016

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate17of128submissions,13%

          Upcoming Conference

          FSE '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader