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

Understanding the impact of refactoring on smells: a longitudinal study of 23 software projects

Published: 21 August 2017 Publication History

Abstract

Code smells in a program represent indications of structural quality problems, which can be addressed by software refactoring. However, refactoring intends to achieve different goals in practice, and its application may not reduce smelly structures. Developers may neglect or end up creating new code smells through refactoring. Unfortunately, little has been reported about the beneficial and harmful effects of refactoring on code smells. This paper reports a longitudinal study intended to address this gap. We analyze how often commonly-used refactoring types affect the density of 13 types of code smells along the version histories of 23 projects. Our findings are based on the analysis of 16,566 refactorings distributed in 10 different types. Even though 79.4% of the refactorings touched smelly elements, 57% did not reduce their occurrences. Surprisingly, only 9.7% of refactorings removed smells, while 33.3% induced the introduction of new ones. More than 95% of such refactoring-induced smells were not removed in successive commits, which suggest refactorings tend to more frequently introduce long-living smells instead of eliminating existing ones. We also characterized and quantified typical refactoring-smell patterns, and observed that harmful patterns are frequent, including: (i) approximately 30% of the Move Method and Pull Up Method refactorings induced the emergence of God Class, and (ii) the Extract Superclass refactoring creates the smell Speculative Generality in 68% of the cases.

References

[1]
R. Arcoverde, I. Macia, A. Garcia, and A. von Staa. 2012. Automatically detecting architecturally-relevant code anomalies. In Proceedings of the 3rd International Workshop on Recommendation Systems for Software Engineering (RSSE). IEEE Computer Society, Washington, DC, USA, 90–91. 2012.6233419
[2]
Gabriele Bavota, Bernardino De Carluccio, Andrea De Lucia, Massimiliano Di Penta, Rocco Oliveto, and Orazio Strollo. 2012. When Does a Refactoring Induce Bugs? An Empirical Study. In Proceedings of the 12th International Working Conference on Source Code Analysis and Manipulation (SCAM ’12). IEEE Computer Society, Washington, DC, USA, 10. Understanding the Impact of Refactoring on Smells: A Longitudinal Study of 23 Software Projects ESEC/FSE’17, September 4–8, 2017, Paderborn, Germany
[3]
Gabriele Bavota, Andrea De Lucia, Massimiliano Di Penta, Rocco Oliveto, and Fabio Palomba. 2015. An experimental investigation on the innate relationship between quality and refactoring. Journal of Systems and Software 107 (2015), 1 – 14.
[4]
Diego Cedrim. 2017. Experiment data of the research. http://diegocedrim.github. io/fse-2017-data/. (2017). {Online; accessed 6-july-2017}.
[5]
Diego Cedrim, Leonardo da Silva Sousa, Alessandro F. Garcia, and Rohit Gheyi. 2016. Does refactoring improve software structural quality? A longitudinal study of 25 projects. In Proceedings of the 30th Brazilian Symposium on Software Engineering. ACM, New York, NY, USA, 73–82.
[6]
[7]
Diego Cedrim and Leonardo Sousa. 2017. Organic. https://github.com/ diegocedrim/organic. (2017). {Online; accessed 6-july-2017}.
[8]
Manuele Ferreira, Eiji Barbosa, Isela Macia, Roberta Arcoverde, and Alessandro Garcia. 2014. Detecting Architecturally-relevant Code Anomalies: A Case Study of Effectiveness and Effort. In Proceedings of the 29th Annual ACM Symposium on Applied Computing (SAC ’14). ACM, New York, NY, USA, 1158–1163.
[9]
Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. 1999. Refactoring: Improving the Design of Existing Code (1 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. 464 pages.
[10]
Kenji Fujiwara, Kyohei Fushida, Norihiro Yoshida, and Hajimu Iida. 2013. Assessing Refactoring Instances and the Maintainability Benefits of Them from Version Archives. In Product-Focused Software Process Improvement. Vol. 7983.
[11]
Springer Publishing Company, Incorporated, Berlin, Germany, 313–323.
[12]
Alessandro Gurgel, Isela Macia, Alessandro Garcia, Arndt von Staa, Mira Mezini, Michael Eichberg, and Ralf Mitschke. 2014. Blending and Reusing Rules for Architectural Degradation Prevention. In Proceedings of the 13th International Conference on Modularity (MODULARITY ’14). ACM, New York, NY, USA, 61–72.
[13]
Mario Hozano, Alessandro Garcia, Nuno Antunes, Baldoino Fonseca, and Evandro Costa. 2017. Smells Are Sensitive to Developers!: On the Efficiency of (Un)Guided Customized Detection. In Proceedings of the 25th International Conference on Program Comprehension (ICPC ’17). IEEE Press, Piscataway, NJ, USA, 110–120.
[14]
Cory J. Kapser and Michael W. Godfrey. 2008. "Cloning Considered Harmful" Considered Harmful: Patterns of Cloning in Software. Empirical Software Engineering 13, 6 (Dec. 2008), 645–692.
[15]
Foutse Khomh, Massimiliano Di Penta, Yann-Gaël Guéhéneuc, and Giuliano Antoniol. 2012. An exploratory study of the impact of antipatterns on class change- and fault-proneness. Empirical Software Engineering 17, 3 (2012), 243– 275.
[16]
Miryung Kim, Thomas Zimmermann, and Nachiappan Nagappan. 2012. A Field Study of Refactoring Challenges and Benefits. In Proceedings of the 20th International Symposium on the Foundations of Software Engineering (FSE ’12). ACM, New York, NY, USA, Article 50, 11 pages.
[17]
Michele Lanza and Radu Marinescu. 2010. Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems (1st ed.). Springer Publishing Company, Incorporated, Berlin, Germany.
[18]
Isela Macia. 2013. On the detection of architecturally relevant code anomalies in software systems. Ph.D. Dissertation. Pontifical Catholic University of Rio de Janeiro.
[19]
Isela Macia, Roberta Arcoverde, Alessandro Garcia, Christina Chavez, and Arndt von Staa. 2012. On the Relevance of Code Anomalies for Identifying Architecture Degradation Symptoms. In Proceedings of the 16th European Conference on Software Maintenance and Reengineering (CSMR ’12). IEEE Computer Society, Washington, DC, USA, 277–286.
[20]
Isela Macia, Alessandro Garcia, Christina Chavez, and Arndt von Staa. 2013. Enhancing the Detection of Code Anomalies with Architecture-Sensitive Strategies. In Proceedings of the 17th European Conference on Software Maintenance and Reengineering. IEEE Computer Society, Washington, DC, USA, 177–186.
[21]
Isela Macia, Joshua Garcia, Daniel Popescu, Alessandro Garcia, Nenad Medvidovic, and Arndt von Staa. 2012. Are Automatically-detected Code Anomalies Relevant to Architectural Modularity?: An Exploratory Analysis of Evolving Systems. In Proceedings of the 11th Annual International Conference on Aspectoriented Software Development (AOSD ’12). ACM, New York, NY, USA, 167–178.
[22]
Isela Macia Bertran, Alessandro Garcia, and Arndt von Staa. 2011. An Exploratory Study of Code Smells in Evolving Aspect-oriented Systems. In Proceedings of the 10th International Conference on Aspect-oriented Software Development (AOSD ’11). ACM, New York, NY, USA, 203–214.
[23]
Leandra Mara, Gustavo Honorato, Francisco Dantas Medeiros, Alessandro Garcia, and Carlos Lucena. 2011. Hist-Inspect: A Tool for History-sensitive Detection of Code Smells. In Proceedings of the 10th International Conference on Aspect-oriented Software Development Companion (AOSD ’11). ACM, New York, NY, USA, 65–66.
[24]
Emerson Murphy-Hill, Chris Parnin, and Andrew P. Black. 2009. How We Refactor, and How We Know It. In Proceedings of the 31st International Conference on Software Engineering (ICSE ’09). IEEE Computer Society, Washington, DC, USA, 287–297.
[25]
Willian Oizumi, Alessandro Garcia, Thelma Colanzi, Manuele Ferreira, and Arndt von Staa. 2015. On the relationship of code-anomaly agglomerations and architectural problems. Journal of Software Engineering Research and Development 3 (2015), 11.
[26]
Willian Oizumi, Alessandro Garcia, Leonardo da Silva Sousa, Bruno Cafeo, and Yixue Zhao. 2016. Code Anomalies Flock Together: Exploring Code Anomaly Agglomerations for Locating Design Problems. In Proceedings of the 38th International Conference on Software Engineering (ICSE ’16). ACM, New York, NY, USA, 440–451.
[27]
Fabio Palomba, Gabriele Bavota, Massimiliano Di Penta, Rocco Oliveto, and Andrea De Lucia. 2014. Do They Really Smell Bad? A Study on Developers’ Perception of Bad Code Smells. In Proceedings of the 30th IEEE International Conference on Software Maintenance and Evolution. IEEE Computer Society, Washington, DC, USA, 101–110.
[28]
Jacek Ratzinger, Thomas Sigmund, and Harald C. Gall. 2008. On the Relation of Refactorings and Software Defect Prediction. In Proceedings of the 2008 International Working Conference on Mining Software Repositories (MSR ’08). ACM, New York, NY, USA, 35–38.
[29]
Danilo Silva, Nikolaos Tsantalis, and Marco Tulio Valente. 2016. Why We Refactor? Confessions of GitHub Contributors. In Proceedings of the 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE 2016). ACM, New York, NY, USA, 858–870.
[30]
Gustavo Soares, Rohit Gheyi, and Tiago Massoni. 2013. Automated Behavioral Testing of Refactoring Engines. IEEE Transactions on Software Engineering 39, 2 (Feb. 2013), 147–162.
[31]
Konstantinos Stroggylos and Diomidis Spinellis. 2007. Refactoring–Does It Improve Software Quality?. In Proceedings of the 5th International Workshop on Software Quality (WoSQ ’07). IEEE Computer Society, Washington, DC, USA, 10–.
[32]
Nikolaos Tsantalis. 2017. RefactoringMiner github page. https://github.com/ tsantalis/RefactoringMiner. (2017). {Online; accessed 6-july-2017; version 0.2.0}.
[33]
Nikolaos Tsantalis, Victor Guana, Eleni Stroulia, and Abram Hindle. 2013. A Multidimensional Empirical Study on Refactoring Activity. In Proceedings of the 2013 Conference of the Center for Advanced Studies on Collaborative Research (CASCON ’13). IBM Corp., Riverton, NJ, USA, 132–146. http://dl.acm.org/citation. cfm?id=2555523.2555539
[34]
Michele Tufano, Fabio Palomba, Gabriele Bavota, Rocco Oliveto, Massimiliano Di Penta, Andrea De Lucia, and Denys Poshyvanyk. 2015. When and Why Your Code Starts to Smell Bad. In Proceedings of the 37th International Conference on Software Engineering (ICSE ’15). IEEE Press, Piscataway, NJ, USA, 403–414. http://dl.acm.org/citation.cfm?id=2818754.2818805
[35]
Zhenchang Xing and Eleni Stroulia. 2005. UMLDiff: An Algorithm for Objectoriented Design Differencing. In Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering (ASE ’05). ACM, New York, NY, USA, 54–65.
[36]
Aiko Yamashita. 2014. Assessing the Capability of Code Smells to Explain Maintenance Problems: An Empirical Study Combining Quantitative and Qualitative Data. Empirical Software Engineering 19, 4 (Aug. 2014), 1111–1143.
[37]
Aiko Yamashita and Steve Counsell. 2013. Code smells as system-level indicators of maintainability: An empirical study. Journal of Systems and Software 86, 10 (2013), 2639 – 2653.
[38]
Aiko Yamashita and Leon Moonen. 2013. Do developers care about code smells? An exploratory survey. In Proceedings of the 20th Working Conference on Reverse Engineering, Ralf Lämmel, Rocco Oliveto, and Romain Robbes (Eds.). IEEE Computer Society, Washington, DC, USA, 242–251.
[39]
Aiko Yamashita and Leon Moonen. 2013. Do developers care about code smells? An exploratory survey. In Proceedings of the 20th Working Conference on Reverse Engineering. IEEE Computer Society, Washington, DC, USA, 242–251.
[40]
Aiko Yamashita and Leon Moonen. 2013. Exploring the Impact of Inter-smell Relations on Software Maintainability: An Empirical Study. In Proceedings of the 35th International Conference on Software Engineering (ICSE ’13). IEEE Press, Piscataway, NJ, USA, 682–691. http://dl.acm.org/citation.cfm?id=2486788.2486878
[41]
Aiko Yamashita and Leon Moonen. 2013. To What Extent Can Maintenance Problems Be Predicted by Code Smell Detection? - An Empirical Study. Information and Software Technology 55, 12 (Dec. 2013), 2223–2242.

Cited By

View all
  • (2024)Message Chain Odor Caused by Excessive Coupling Based on Deep LearningArtificial Intelligence and Robotics Research10.12677/airr.2024.13409113:04(891-900)Online publication date: 2024
  • (2024)Detecting Refactoring Commits in Machine Learning Python Projects: A Machine Learning-Based ApproachACM Transactions on Software Engineering and Methodology10.1145/370530934:3(1-25)Online publication date: 22-Nov-2024
  • (2024)A Meta-Study of Software-Change IntentionsACM Computing Surveys10.1145/3661484Online publication date: 25-Apr-2024
  • Show More Cited By

Index Terms

  1. Understanding the impact of refactoring on smells: a longitudinal study of 23 software projects

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ESEC/FSE 2017: Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering
    August 2017
    1073 pages
    ISBN:9781450351058
    DOI:10.1145/3106237
    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]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 21 August 2017

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Code Smells
    2. Refactoring
    3. Structural Quality

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    ESEC/FSE'17
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 112 of 543 submissions, 21%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)65
    • Downloads (Last 6 weeks)9
    Reflects downloads up to 02 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Message Chain Odor Caused by Excessive Coupling Based on Deep LearningArtificial Intelligence and Robotics Research10.12677/airr.2024.13409113:04(891-900)Online publication date: 2024
    • (2024)Detecting Refactoring Commits in Machine Learning Python Projects: A Machine Learning-Based ApproachACM Transactions on Software Engineering and Methodology10.1145/370530934:3(1-25)Online publication date: 22-Nov-2024
    • (2024)A Meta-Study of Software-Change IntentionsACM Computing Surveys10.1145/3661484Online publication date: 25-Apr-2024
    • (2024)Enhancing Recommendations of Composite Refactorings based on the Practice2024 IEEE International Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM63643.2024.00018(83-93)Online publication date: 7-Oct-2024
    • (2024)On the Impact of Refactorings on Software Attack SurfaceIEEE Access10.1109/ACCESS.2024.340405812(128570-128584)Online publication date: 2024
    • (2024)A comprehensive catalog of refactoring strategies to handle test smells in Java-based systemsSoftware Quality Journal10.1007/s11219-024-09663-732:2(641-679)Online publication date: 1-Jun-2024
    • (2023)Exploring the Intersection between Software Maintenance and Machine Learning—A Systematic Mapping StudyApplied Sciences10.3390/app1303171013:3(1710)Online publication date: 29-Jan-2023
    • (2023)An Empirical Study of Refactoring Rhythms and Tactics in the Software Development ProcessIEEE Transactions on Software Engineering10.1109/TSE.2023.332677549:12(5103-5119)Online publication date: Dec-2023
    • (2023)Automating Test-Specific Refactoring Mining: A Mixed-Method Investigation2023 IEEE 23rd International Working Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM59687.2023.00013(13-24)Online publication date: 2-Oct-2023
    • (2023)Don’t Forget the Exception! : Considering Robustness Changes to Identify Design Problems2023 IEEE/ACM 20th International Conference on Mining Software Repositories (MSR)10.1109/MSR59073.2023.00064(417-429)Online publication date: May-2023
    • Show More Cited By

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media