Poster: The Buggy Side of Code Refactoring: Understanding the Relationship Between Refactorings and Bug

Code refactoring is widely practiced by software developers. There is an explicit assumption that code refactoring improves the structural quality of a software project, thereby also reducing its bug proneness. However, refactoring is often applied with different purposes in practice. Depending on the complexity of certain refactorings, developers might unconsciously make the source code more susceptible to have bugs. In this paper, we present a longitudinal study of 5 Java open source projects, where 20,689 refactorings, and 1,033 bug reports were analyzed. We found that many bugs are introduced in the refactored code as soon as the first immediate change is made on it. Furthermore, code elements affected by refactorings performed in conjunction with other changes are more prone to have bugs than those affected by pure refactorings.

[1]  Harald C. Gall,et al.  On the relation of refactorings and software defect prediction , 2008, MSR '08.

[2]  Andrea De Lucia,et al.  Smells Like Teen Spirit: Improving Bug Prediction Performance Using the Intensity of Code Smells , 2016, 2016 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[3]  Don Roberts,et al.  Refactoring , 2015, IEEE Softw..

[4]  Gabriele Bavota,et al.  When Does a Refactoring Induce Bugs? An Empirical Study , 2012, 2012 IEEE 12th International Working Conference on Source Code Analysis and Manipulation.

[5]  Andrew P. Black,et al.  How we refactor, and how we know it , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[6]  Stephan Diehl,et al.  Are refactorings less error-prone than other changes? , 2006, MSR '06.

[7]  Andreas Zeller,et al.  When do changes induce fixes? , 2005, ACM SIGSOFT Softw. Eng. Notes.