skip to main content
10.1145/3379597.3387477acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article
Open access

Characterizing and Identifying Composite Refactorings: Concepts, Heuristics and Patterns

Published: 18 September 2020 Publication History

Abstract

Refactoring consists of a transformation applied to improve the program internal structure, for instance, by contributing to remove code smells. Developers often apply multiple interrelated refactorings called composite refactoring. Even though composite refactoring is a common practice, an investigation from different points of view on how composite refactoring manifests in practice is missing. Previous empirical studies also neglect how different kinds of composite refactorings affect the removal, prevalence or introduction of smells. To address these matters, we provide a conceptual framework and two heuristics to respectively characterize and identify composite refactorings within and across commits. Then, we mined the commit history of 48 GitHub software projects. We identified and analyzed 24,911 composite refactorings involving 104,505 single refactorings. Amongst several findings, we observed that most composite refactorings occur in the same commit and have the same refactoring type. We found that several refactorings are semantically related to each other, which occur in different parts of the system but are still related to the same task. Our study is the first to reveal that many smells are introduced in a program due to "incomplete" composite refactorings. Our study is also the first to reveal 111 patterns of composite refactorings that frequently introduce or remove certain smell types. These patterns can be used as guidelines for developers to improve their refactoring practices as well as for designers of recommender systems.

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 European Software Engineering Conference; 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 ACM/IEEE International Conference on Automated Software Engineering (ASE 2018). ACM, New York, NY, USA, 464--474. https://doi.org/10.1145/3238147.3238217
[3]
Eman Abdullah AlOmar, Mohamed Wiem Mkaouer, Ali Ouni, and Marouane Kessentini. 2019. Do Design Metrics Capture Developers Perception of Quality? An Empirical Study on Self-Affirmed Refactoring Activities. In 13th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM 2019).
[4]
Roberta Arcoverde, Isela Macia, Alessandro Garcia, and Arndt von Staa. 2012. Automatically Detecting Architecturally-Relevant Code Anomalies. Proceedings of the International Workshop on Recommendation Systems for Software Engineering (2012), 90--91. https://doi.org/10.1109/RSSE.2012.6233419
[5]
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. https://doi.org/10.1016/j.jss.2015.05.024
[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 International Symposium on Empirical Software Engineering and Measurement (ESEM). 1--11.
[7]
Arnaud Blouin, Valéria Lelli, Benoit Baudry, and Fabien Coulon. 2018. User interface design smell: Automatic detection and refactoring of Blob listeners. Information and Software Technology 102 (2018), 49--64. https://doi.org/10.1016/j.infsof.2018.05.005
[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, 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. https://doi.org/10.1145/2973839.2973848
[10]
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 Joint Meeting on Foundations of Software Engineering (ESEC/FSE 2017). ACM, New York, NY, USA, 465--475. https://doi.org/10.1145/3106237.3106259
[11]
Alexander Chávez, Isabella Ferreira, Eduardo Fernandes, Diego Cedrim, and Alessandro Garcia. 2017. How Does Refactoring Affect Internal Quality Attributes? A Multi-Project Study. In Proceedings of the 31st Brazilian Symposium on Software Engineering (SBES'17). ACM, New York, NY, USA, 74--83. https://doi.org/10.1145/3131151.3131171
[12]
Rafael Maiani de Mello, Anderson G. Uchôa, Roberto Felicio Oliveira, Willian Nalepa Oizumi, Jairo Souza, Kleyson Mendes, Daniel Oliveira, Baldoino Fonseca, and Alessandro Garcia. 2019. Do Research and Practice of Code Smell Identification Walk Together? A Social Representations Analysis. In 2019 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, ESEM 2019, Porto de Galinhas, Recife, Brazil, September 19-20, 2019. IEEE, 1--6.
[13]
Danny Dig, Kashif Manzoor, Ralph Johnson, and Tien N. Nguyen. 2007. Refactoring-Aware Configuration Management for Object-Oriented Programs. In Proceedings of the 29th International Conference on Software Engineering (ICSE '07). IEEE Computer Society, Washington, DC, USA, 427--436. https://doi.org/10.1109/ICSE.2007.71
[14]
Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. 1999. Refactoring: Improving The Design Of Existing Code (1st ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. 464 pages.
[15]
Kenji Fujiwara, Kyohei Fushida, Norihiro Yoshida, and Hajimu Iida. 2013. Assessing Refactoring Instances and the Maintainability Benefits of Them from Version Archives. Springer Berlin Heidelberg, Berlin, Heidelberg, 313--323. https://doi.org/10.1007/978-3-642-39259-7_25
[16]
Birgit Geppert, Audris Mockus, and Frank Rossler. 2005. Refactoring for Changeability: A Way to Go?. In Proceedings of the 11th IEEE International Software Metrics Symposium (METRICS 05). IEEE Computer Society, Washington, DC, USA, 13-. https://doi.org/10.1109/METRICS.2005.40
[17]
Everton T. Guimarães, Alessandro F. Garcia, and Yuanfang Cai. 2015. Architecture-sensitive heuristics for prioritizing critical code anomalies. In Proceedings of the 14th International Conference on Modularity, MODULARITY 2015, Fort Collins, CO, USA, March 16-19, 2015, Robert B. France, Sudipto Ghosh, and Gary T. Leavens (Eds.). ACM, 68--80.
[18]
Mark Harman and Laurence Tratt. 2007. Pareto optimal search based refactoring at the design level. In 9th Genetic and Evolutionary Computation Conference (GECCO). 1106--1113.
[19]
Miryung Kim, Thomas Zimmermann, and Nachiappan Nagappan. 2012. A Field Study of Refactoring Challenges and Benefits. In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering (FSE 12). ACM, New York, NY, USA, Article 50, 11 pages. https://doi.org/10.1145/2393596.2393655
[20]
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. https://doi.org/10.1109/TSE.2014.2318734
[21]
H. Kirinuki, Y. Higo, K. Hotta, and S. Kusumoto. 2016. Splitting Commits via Past Code Changes. In 2016 23rd Asia-Pacific Software Engineering Conference (APSEC). 129--136. https://doi.org/10.1109/APSEC.2016.028
[22]
Martin Kuhlemann, Liang Liang, and Gunter Saake. 2010. Algebraic and cost-based optimization of refactoring sequences. In 2nd International Workshop on Model-driven Product Line Engineering (MDPLE). 37--48.
[23]
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.
[24]
Yun Lin, Xin Peng, Yuanfang Cai, Danny Dig, Diwen Zheng, and Wenyun Zhao. 2016. Interactive and guided architectural refactoring with search-based recommendation. In 24th International Symposium on Foundations of Software Engineering(FSE). 535--546.
[25]
Kui Liu, Dongsun Kim, Tegawendé F. Bissyandé, Taeyoung Kim, Kisub Kim, Anil Koyuncu, Suntae Kim, and Yves Le Traon. 2019. Learning to Spot and Refactor Inconsistent Method Names. In Proceedings of the 41st International Conference on Software Engineering (ICSE '19). IEEE Press, Piscataway, NJ, USA, 1--12. https://doi.org/10.1109/ICSE.2019.00019
[26]
Isela Macia. 2013. On The Detection Of Architecturally Relevant Code Anomalies In Software Systems. Ph.D. Dissertation. Pontifical Catholic University of Rio de Janeiro.
[27]
Isela Macia, Roberta Arcoverde, Alessandro Garcia, Christina Chavez, and Arndt von Staa. 2012. On the Relevance of Code Anomalies for Identifying Architecture Degradation Symptoms. Proceedings of the 16th European Conference on Software Maintenance and Reengineering (2012), 277--286. https://doi.org/10.1109/CSMR.2012.35
[28]
Mehran Mahmoudi, Sarah Nadi, and Nikolaos Tsantalis. 2019. Are Refactorings to Blame? An Empirical Study of Refactorings in Merge Conflicts. In 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, 151--162.
[29]
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. https://doi.org/10.1145/1960314.1960335
[30]
Panita Meananeatra. 2012. Identifying Refactoring Sequences For Improving Software Maintainability. In Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering. ACM Press, New York, New York, USA, 406--409. https://doi.org/10.1145/2351676.2351760
[31]
Mohamed Wiem Mkaouer, Marouane Kessentini, Slim Bechikh, Kalyanmoy Deb, and Mel Ó Cinnéide. 2014. Recommendation system for software refactoring using innovization and interactive dynamic optimization. In 29th International Conference on Automated Software Engineering(ASE). 331--336.
[32]
E. Murphy-Hill and A. P. Black. 2008. Refactoring Tools: Fitness for Purpose. IEEE Software 25, 5 (Sep. 2008), 38--44. https://doi.org/10.1109/MS.2008.123
[33]
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. https://doi.org/10.1109/TSE.2011.41
[34]
Mel Ó Cinnéide and Paddy Nixon. 2000. Composite refactorings for Java programs. In Proceedings of the Workshop on Formal Techniques for Java Programs, co-located with the 14th European Conference on Object-Oriented Programming (ECOOP). 1--6.
[35]
Willian Nalepa Oizumi, Leonardo da Silva Sousa, Anderson Oliveira, Alessandro Garcia, O. I. Anne Benedicte Agbachi, Roberto Felicio Oliveira, and Carlos Lucena. 2018. On the identification of design problems in stinky code: experiences and tool support. J. Braz. Comp. Soc. 24, 1 (2018), 13:1-13:30.
[36]
Willian Nalepa Oizumi, Alessandro F. Garcia, Leonardo da Silva Sousa, Bruno Barbieri Pontes 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 2016, Austin, TX, USA, May 14-22, 2016, Laura K. Dillon, Willem Visser, and Laurie Williams (Eds.). ACM, 440--451.
[37]
Mark O'Keeffe and Mel Ó Cinnéide. 2008. Search-based Refactoring: An Empirical Study. J. Softw. Maint. Evol. 20, 5 (Sept. 2008), 345--364. https://doi.org/10.1002/smr.v20:5
[38]
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, ICSE-SEIP 2017, Buenos Aires, Argentina, May 20-28, 2017. IEEE Computer Society, 33--42.
[39]
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).
[40]
William F. Opdyke. 1992. Refactoring Object-oriented Frameworks. Ph.D. Dissertation. Champaign, IL, USA. UMI Order No. GAX93--05645.
[41]
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.
[42]
Ali Ouni, Marouane Kessentini, and Houari Sahraoui. 2013. Search-based refactoring using recorded code changes. In 17th European Conference on Software Maintenance and Reengineering (CSMR). 221--230.
[43]
2020 Replication Package. 2020. https://figshare.com/s/81f7973d07ceb7e4796c.
[44]
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 International Conference on Program Comprehension (ICPC). IEEE, 176--185.
[45]
E. Piveta, J. Araujo, M. Pimenta, A. Moreira, P. Guerreiro, and R. T. Price. 2008. Searching for Opportunities of Refactoring Sequences: Reducing the Search Space. In 2008 32nd Annual IEEE International Computer Software and Applications Conference. 319--326. https://doi.org/10.1109/COMPSAC.2008.119
[46]
K. Prete, N. Rachatasumrit, N. Sudan, and M. Kim. 2010. Template-Based Reconstruction of Complex Refactorings. In Proceedings of IEEE International Conference on Software Maintenance. 1--10. https://doi.org/10.1109/ICSM.2010.5609577
[47]
Jacek Ratzinger, Thomas Sigmund, and Harald C Gall. 2008. On The Relation of Refactorings and Software Defect Prediction. In Proceedings of the International Workshop on Mining Software Repositories. ACM Press, New York, New York, USA, 35--38. https://doi.org/10.1145/1370750.1370759
[48]
Veselin Raychev, Max Schäfer, Manu Sridharan, and Martin Vechev. 2013. Refactoring with synthesis. ACM SIGPLAN Notices 48, 10 (2013), 339--354.
[49]
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 (FSE2016). ACM, New York, NY, USA, 858--870. https://doi.org/10.1145/2950290.2950305
[50]
Gábor Szőke, Gábor Antal, Csaba Nagy, Rudolf Ferenc, and Tibor Gyimóthy. 2017. Empirical study on refactoring large-scale industrial systems and its effects on maintainability. Journal of Systems and Software 129 (2017), 107--126.
[51]
Nikolaos Tsantalis, Theodoros Chaikalis, and Alexander Chatzigeorgiou. 2018. Ten years of JDeodorant: Lessons learned from the hunt for smells. In 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, 4--14.
[52]
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 International Conference on Software Engineering (ICSE '18). ACM, New York, NY, USA, 483--494. https://doi.org/10.1145/3180155.3180206
[53]
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.
[54]
Carmine Vassallo, Giovanni Grano, Fabio Palomba, Harald C. Gall, and Alberto Bacchelli. 2019. A large-scale empirical exploration on refactoring activities in open source software projects. Science of Computer Programming 180 (2019), 1--15. https://doi.org/10.1016/j.scico.2019.05.002
[55]
Santiago A. Vidal, Willian Nalepa Oizumi, Alessandro Garcia, J. Andres Diaz-Pace, and Claudia Marcos. 2019. Ranking architecturally critical agglomerations of code smells. Sci. Comput. Program. 182 (2019), 64--85.
[56]
Aiko Yamashita and Leon Moonen. 2013. Exploring the Impact of Inter-Smell Relations on Software Maintainability: An Empirical Study. Proceedings of the International Conference on Software Engineering (2013), 682--691. https://doi.org/10.1109/ICSE.2013.6606614
[57]
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 (2013), 2223--2242. https://doi.org/10.1016/j.infsof.2013.08.002
[58]
Young Seok Yoon and Brad A. Myers. 2015. Supporting Selective Undo in a Code Editor. In Proceedings of the 37th International Conference on Software Engineering - Volume 1 (ICSE '15). IEEE Press, Piscataway, NJ, USA, 223--233. http://dl.acm.org/citation.cfm?id=2818754.2818784
[59]
Trevor J. Young. 2005. Using Aspect J to build a software product line for mobile devices. Ph.D. Dissertation. https://doi.org/10.14288/1.0051632

Cited By

View all
  • (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)A refactoring categorization model for software quality improvementPLOS ONE10.1371/journal.pone.029374218:11(e0293742)Online publication date: 2-Nov-2023
  • Show More Cited By

Index Terms

  1. Characterizing and Identifying Composite Refactorings: Concepts, Heuristics and Patterns

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    MSR '20: Proceedings of the 17th International Conference on Mining Software Repositories
    June 2020
    675 pages
    ISBN:9781450375177
    DOI:10.1145/3379597
    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

    In-Cooperation

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 18 September 2020

    Permissions

    Request permissions for this article.

    Check for updates

    Qualifiers

    • Research-article
    • Research
    • Refereed limited

    Conference

    MSR '20
    Sponsor:

    Upcoming Conference

    ICSE 2025

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

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

    Other Metrics

    Citations

    Cited By

    View all
    • (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)A refactoring categorization model for software quality improvementPLOS ONE10.1371/journal.pone.029374218:11(e0293742)Online publication date: 2-Nov-2023
    • (2023)Dependent or Not: Detecting and Understanding Collections of RefactoringsIEEE Transactions on Software Engineering10.1109/TSE.2023.3244123(1-15)Online publication date: 2023
    • (2023)Testability Refactoring in Pull Requests: Patterns and Trends2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)10.1109/ICSE48619.2023.00131(1508-1519)Online publication date: May-2023
    • (2023)A Refactoring Classification Framework for Efficient Software MaintenanceIEEE Access10.1109/ACCESS.2023.329867811(78904-78917)Online publication date: 2023
    • (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(111817)Online publication date: Nov-2023
    • (2023)Composite refactoring: Representations, characteristics and effects on software projectsInformation and Software Technology10.1016/j.infsof.2022.107134156(107134)Online publication date: Apr-2023
    • (2023)Machine Learning-Based Exploration of the Impact of Move Method Refactoring on Object-Oriented Software Quality AttributesArabian Journal for Science and Engineering10.1007/s13369-023-08174-049:3(3867-3885)Online publication date: 21-Aug-2023
    • (2023)Towards a catalog of composite refactoringsJournal of Software: Evolution and Process10.1002/smr.2530Online publication date: 22-Jan-2023
    • Show More Cited By

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Login options

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media