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.
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- K. Beck. Extreme Programming Explained: Embrace Change. Addison-Wesley, 2000. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, Boston, MA, USA, 1999. Google ScholarDigital Library
- J. L. Hintze and R. D. Nelson. Violin plots: A box plot-density trace synergism. The American Statistician, 52(2):181–184, 1998.Google ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- T. Mens and T. Tourwe. A survey of software refactoring. IEEE Trans. Softw. Eng., 30(2):126–139, 2004. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- W. F. Opdyke. Refactoring object-oriented frameworks. PhD thesis, University of Illinois at Urbana-Champaign, IL, USA, 1992. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- N. Tsantalis and A. Chatzigeorgiou. Identification of Move Method refactoring opportunities. IEEE Trans. Softw. Eng., 35(3):347–367, May 2009. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
Index Terms
- Why we refactor? confessions of GitHub contributors
Recommendations
An approach to prioritize code smells for refactoring
Code smells are a popular mechanism to find structural design problems in software systems. Consequently, several tools have emerged to support the detection of code smells. However, the number of smells returned by current tools usually exceeds the ...
Towards a catalog of aspect-oriented refactorings
AOSD '05: Proceedings of the 4th international conference on Aspect-oriented software developmentIn this paper, we present a collection of aspect-oriented refactorings covering both the extraction of aspects from object-oriented legacy code and the subsequent tidying up of the resulting aspects. In some cases, this tidying up entails the ...
On experimenting refactoring tools to remove code smells
XP '15 workshops: Scientific Workshop Proceedings of the XP2015When we develop a software project of a certain complexity, source code maintainability could become a problem, in particular if developers do not use a consolidate development process that simplifies the management of the entire project. When source ...
Comments