skip to main content
10.1145/3422392.3422423acmotherconferencesArticle/Chapter ViewAbstractPublication PagessbesConference Proceedingsconference-collections
research-article

Recommending Composite Refactorings for Smell Removal: Heuristics and Evaluation

Published: 21 December 2020 Publication History

Abstract

Structural degradation is the process in which quality attributes of a system are negatively impacted. When due attention is not paid to structural degradation, the source code may also become difficult to change. Code smells are recurring structures in the source code that may represent structural degradation. Hence, there are many catalogs and techniques for supporting the removal of code smells through refactoring recommendations, which usually consist of single refactorings such as a Move Method or an Extract Method. However, single refactorings are often not enough for completely removing certain smell occurrences. Moreover, recent studies show that developers most often apply composite refactorings - i.e., sequences of two or more refactorings - for removing code smells. Despite showing the importance of performing composite refactorings, most studies do not provide information on which composite refactoring patterns are recurrent in practice. In this context, a previous study identified 35 smell removal patterns that are frequent across multiple open source systems. However, such study has not explored how the removal patterns could help developers to apply effective composite refactorings. Thus, in this work, we propose a suite of new recommendation heuristics to help developers in applying effective composite refactorings. These heuristics are intended to remove three code smell types, namely Complex Class, Feature Envy, and God Class. After designing the heuristics, we evaluated their effectiveness through a quasi-experiment. This evaluation was conducted with 12 software developers and 9 smelly Java classes. Results indicate that developers considered our heuristics effective or partially effective in more than 93% of the cases. In addition, the evaluation helped us to identify multiple factors that contribute to the acceptance or rejection of the refactoring recommendations. Based on these factors, we defined new guidelines for the effective recommendation of smell-removal composite refactorings.

References

[1]
M Abbes, F Khomh, Y Gueheneuc, and G Antoniol. 2011. An Empirical Study of the Impact of Two Antipatterns, Blob and Spaghetti Code, on Program Comprehension. In Proceedings of the 15th ESEC; Oldenburg, Germany. 181--190.
[2]
Vahid Alizadeh and Marouane Kessentini. 2018. Reducing Interactive Refactoring Effort via Clustering-based Multi-objective Search. In Proceedings of the 33rd ASE. ACM, New York, NY, USA, 464--474.
[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).
[4]
Gabriele Bavota, Andrea De Lucia, Andrian Marcus, and Rocco Oliveto. 2014. Recommending Refactoring Operations in Large Software Systems. Springer Berlin Heidelberg, Berlin, Heidelberg, 387--419.
[5]
Gabriele Bavota, Malcom Gethers, Rocco Oliveto, Denys Poshyvanyk, and Andrea de Lucia. 2014. Improving Software Modularization via Automated Analysis of Latent Topics and Dependencies. ACM Trans. Softw. Eng. Methodol. (2014).
[6]
Ana Carla Bibiano, Eduardo Fernandes, Daniel Oliveira, Alessandro Garcia, Marcos Kalinowski, Baldoino Fonseca, Roberto Oliveira, Anderson Oliveira, and Diego Cedrim. 2019. A Quantitative Study on Characteristics and Effect of Batch Refactoring on Code Smells. In 13th ESEM. 1--11.
[7]
Ana Carla Bibiano, Vinicius Soares, Daniel Coutinho, Eduardo Fernandes, João Correia, Kleber Santos, Anderson Oliveira, Alessandro Garcia, Rohit Gheyi, Baldoino Fonseca, Márcio Ribeiro, Caio Barbosa, and Daniel Oliveira. 2020. How Does Incomplete Composite Refactoring Affect Internal Quality Attributes?. In 28th IEEE/ACM International Conference on Program Comprehension (ICPC).
[8]
Aline Brito, Andre Hora, and Marco Tulio Valente. 2020. Refactoring Graphs: Assessing Refactoring over Time. In 2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE.
[9]
Diego Cedrim, Alessandro Garcia, Melina Mongiovi, Rohit Gheyi, Leonardo Sousa, Rafael de Mello, Baldoino Fonseca, Márcio Ribeiro, and Alexander Chávez. 2017. Understanding the Impact of Refactoring on Smells: A Longitudinal Study of 23 Software Projects. In Proceedings of the 11th ESEC/FSE. ACM, 465--475.
[10]
S. Charalampidou, A. Ampatzoglou, A. Chatzigeorgiou, A. Gkortzis, and P. Avgeriou. 2017. Identifying Extract Method Refactoring Opportunities Based on Functional Relevance. IEEE Transactions on Software Engineering (2017).
[11]
Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. 1999. Refactoring: Improving The Design Of Existing Code.
[12]
2020 Refactoring Guru. 2020. https://refactoring.guru/.
[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 ICPC. Piscataway, NJ, USA.
[14]
Miryung Kim, Thomas Zimmermann, and Nachiappan Nagappan. 2014. An Empirical Study of Refactoring Challenges and Benefits at Microsoft. IEEE Transactions on Software Engineering 40, 7 (2014), 633--649.
[15]
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.
[16]
Jonathan Lazar, Jinjuan Heidi Feng, and Harry Hochheiser. 2017. Research methods in human-computer interaction. Morgan Kaufmann.
[17]
A MacCormack, J Rusnak, and C Baldwin. 2006. Exploring the Structure of Complex Software Designs: An Empirical Study of Open Source and Proprietary Code. Manage. Sci. 52, 7 (2006), 1015--1030.
[18]
E. Murphy-Hill, C. Parnin, and A. P. Black. 2012. How We Refactor, and How We Know It. IEEE Transactions on Software Engineering 38, 1 (2012), 5--18.
[19]
Willian Oizumi, Leonardo Sousa, Anderson Oliveira, Luiz Carvalho, Alessandro Garcia, Thelma Colanzi, and Roberto Oliveira. 2019. On the density and diversity of degradation symptoms in refactored classes: A multi-case study. In 30th International Symposium on Software Reliability Engineering (ISSRE).
[20]
Roberto Felicio Oliveira, Leonardo da Silva Sousa, Rafael Maiani de Mello, Natasha M. Costa Valentim, Adriana Lopes, Tayana Conte, Alessandro F. Garcia, Edson Cesar Cunha de Oliveira, and Carlos José Pereira de Lucena. 2017. Collaborative Identification of Code Smells: A Multi-Case Study. In 39th IEEE/ACM International Conference on Software Engineering: Software Engineering in Practice Track.
[21]
Roberto Felicio Oliveira, Rafael Maiani de Mello, Eduardo Fernandes, Alessandro Garcia, and Carlos Lucena. 2020. Collaborative or individual identification of code smells? On the effectiveness of novice and professional developers. Inf. Softw. Technol. 120 (2020).
[22]
Ali Ouni, Marouane Kessentini, Mel Ó Cinnéide, Houari Sahraoui, Kalyanmoy Deb, and Katsuro Inoue. 2017. MORE: A multi-objective refactoring recommendation approach to introducing design patterns and fixing code smells. Journal of Software: Evolution and Process 29, 5 (2017), e1843.
[23]
Replication Package. 2020. https://refactoringheuristics.github.io/.
[24]
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 ICSME. 101--110.
[25]
Fabio Palomba, Andy Zaidman, Rocco Oliveto, and Andrea De Lucia. 2017. An exploratory study on the relationship between changes and refactoring. In 2017 IEEE/ACM 25th ICPC. IEEE, 176--185.
[26]
Fabiano Pecorelli, Fabio Palomba, Foutse Khomh, and Andrea De Lucia. 2020. Developer-Driven Code Smell Prioritization. In Proceedings of the 2020 MSR.
[27]
William R Shadish, Thomas D Cook, Donald Thomas Campbell, et al. 2002. Experimental and quasi-experimental designs for generalized causal inference/William R. Shedish, Thomas D. Cook, Donald T. Campbell. Boston: Houghton Mifflin.
[28]
Leonardo Sousa, Diego Cedrim, Alessandro Garcia, Willian Oizumi, Ana Carla Bibiano, Daniel Tenorio, Miryung Kim, and Anderson Oliveira. 2020. Characterizing and Identifying Composite Refactorings: Concepts, Heuristics and Patterns. In 17th International Conference on Mining Software Repositories (MSR).
[29]
Leonardo Sousa, Willian Oizumi, Alessandro Garcia, Anderson Oliveira, Diego Cedrim, and Carlos Lucena. 2020. When Are Smells Indicators of Architectural Refactoring Opportunities? A Study of 50 Software Projects. In 28th International Conference on Program Comprehension (ICPC).
[30]
Uchôa et al. 2020. How Does Modern Code Review Impact Software Design Degradation? An In-depth Empirical Study. In 36th ICSME. 1--12.
[31]
Nikolaos Tsantalis, Theodoros Chaikalis, and Alexander Chatzigeorgiou. 2018. Ten years of JDeodorant: Lessons learned from the hunt for smells. In 2018 IEEE 25th SANER. IEEE, 4--14.
[32]
Nikolaos Tsantalis, Matin Mansouri, Laleh M. Eshkevari, Davood Mazinanian, and Danny Dig. 2018. Accurate and Efficient Refactoring Detection in Commit History. In Proceedings of the 40th ICSE. ACM, New York, NY, USA, 483--494.
[33]
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 ICSE (ICSE '15). IEEE Press, Piscataway, NJ, USA, 403--414.
[34]
Aiko Yamashita. 2013. Assessing the Capability of Code Smells to Explain Maintenance Problems: An Empirical Study Combining Quantitative And Qualitative Data. Empirical Software Engineering 19, 4 (2013), 1111--1143.
[35]
Robert K Yin. 2015. Qualitative research from start to finish. Guilford publications.

Cited By

View all
  • (2024)Behind the Intent of Extract Method Refactoring: A Systematic Literature ReviewIEEE Transactions on Software Engineering10.1109/TSE.2023.334580050:4(668-694)Online publication date: 4-Jan-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)Understanding the effect of batch refactoring on software qualityInternational Journal of System Assurance Engineering and Management10.1007/s13198-023-02247-x15:6(2328-2336)Online publication date: 7-Feb-2024
  • Show More Cited By

Index Terms

  1. Recommending Composite Refactorings for Smell Removal: Heuristics and Evaluation

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Other conferences
    SBES '20: Proceedings of the XXXIV Brazilian Symposium on Software Engineering
    October 2020
    901 pages
    ISBN:9781450387538
    DOI:10.1145/3422392
    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 the author(s) 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].

    In-Cooperation

    • SBC: Brazilian Computer Society

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 21 December 2020

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. code smells
    2. composite refactoring
    3. composite refactoring patterns
    4. refactoring
    5. refactoring heuristics
    6. refactoring recommendations

    Qualifiers

    • Research-article
    • Research
    • Refereed limited

    Funding Sources

    • Conselho Nacional de Desenvolvimento Científico e Tecnológico
    • Coordenação de Aperfeiçoamento de Pessoal de Nível Superior
    • Fundação Carlos Chagas Filho de Amparo à Pesquisa do Estado do Rio de Janeiro

    Conference

    SBES '20

    Acceptance Rates

    Overall Acceptance Rate 147 of 427 submissions, 34%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

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

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Behind the Intent of Extract Method Refactoring: A Systematic Literature ReviewIEEE Transactions on Software Engineering10.1109/TSE.2023.334580050:4(668-694)Online publication date: 4-Jan-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)Understanding the effect of batch refactoring on software qualityInternational Journal of System Assurance Engineering and Management10.1007/s13198-023-02247-x15:6(2328-2336)Online publication date: 7-Feb-2024
    • (2023)On the impact of single and co-occurrent refactorings on quality attributes in android applicationsJournal of Systems and Software10.1016/j.jss.2023.111817205:COnline publication date: 1-Nov-2023
    • (2022)The who, what and how of the current research at the Brazilian Symposium on Software EngineeringProceedings of the XXXVI Brazilian Symposium on Software Engineering10.1145/3555228.3555241(11-20)Online publication date: 5-Oct-2022
    • (2022)Refactoring debtProceedings of the 19th International Conference on Mining Software Repositories10.1145/3524842.3528527(127-131)Online publication date: 23-May-2022
    • (2022)An exploratory study on refactoring documentation in issues handlingProceedings of the 19th International Conference on Mining Software Repositories10.1145/3524842.3528525(107-111)Online publication date: 23-May-2022
    • (2022)Completeness of Composite Refactorings for Smell Removal2022 IEEE/ACM 44th International Conference on Software Engineering: Companion Proceedings (ICSE-Companion)10.1109/ICSE-Companion55297.2022.9793758(264-268)Online publication date: May-2022
    • (2021)Look Ahead! Revealing Complete Composite Refactorings and their Smelliness Effects2021 IEEE International Conference on Software Maintenance and Evolution (ICSME)10.1109/ICSME52107.2021.00033(298-308)Online publication date: Sep-2021

    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