On the Characterization, Detection and Impact of Batch Refactoring in Practice

Resumo


Up to 60% of the refactorings in software projects are constituted of a set of interrelated transformations, the so-called batches (or composite refactoring), rather than single transformations applied in isolation. However, a systematic characterization of batch characterization is missing, which hampers the elaboration of proper tooling support and empirical studies of how (batch) refactoring is applied in practice. This paper summarizes the research performed under the context of a Master's dissertation, which aimed at taming the aforementioned problems. To the best of our knowledge, our research is the first work published that provides a conceptual foundation, detection support and an large impact analysis of batch refactoring on code maintainability. To this end, we performed two complementary empirical studies as well as designed a first heuristic aimed at explicitly detecting batch refactorings. Our first study consisted of a literature review that synthesizes the otherwise scattered, partial conceptualization of batch refactoring mentioned in 29 studies with different purposes. We identified and defined seven batch characteristics such as the scope and typology of batches, plus seven types of batch effect on software maintainability, including code smell removal. All batches' characteristics and possible impacts were systematized in a conceptual framework, which assists, for instance, the proper design of batch refactoring studies and batch detection heuristics. We defined a new heuristic for batch detection, which made it possible to conduct a large study involving 4,607 batches discovered in 57 open and closed software projects. Amongst various findings, we reveal that most batches in practice occur entirely within one commit (93%), affect multiple methods (90%). Surprisingly, batches mostly end up introducing (51%) or not removing (38%) code smells. These findings contradict previous investigations limited to the impact analysis of each transformation in isolation. Our findings also enabled us to reveal beneficial or harmful patterns of batches that respectively induces the introduction or removal of certain code smells. These patterns: (i) were not previously documented even in Fowler's refactoring catalog, and (ii) provide concrete guidance for both researchers, tool designers, and practitioners.
Palavras-chave: batch refactoring, code smell, literature review, internal structural quality

Referências

Bavota, G., Lucia, A. D., and Oliveto, R. (2011). Identifying extract class refactoring opportunities using structural and semantic cohesion measures.Journal of Systems and Software (JSS), 84(3):397–414.

Bavota, G., Lucia, A. D., Penta, M. D., Oliveto, R., and Palomba, F. (2015). An experimental investigation on the innate relationship between quality and refactoring.Journal of Systems and Software (JSS), 107:1–14.

Bibiano, A. C., Fernandes, E., Oliveira, D., Garcia, A., Kalinowski, M., Fonseca, B.,Oliveira, R., Oliveira, A., and Cedrim, D. (2019). A quantitative study on characteris-tics and effect of batch refactoring on code smells. In13th International Symposiumon Empirical Software Engineering and Measurement (ESEM), pages 1–11.

Bibiano, A. C. G. (2019).Understanding Characteristics and Structural Effects of Batch Refactorings in Practic Master thesis, PUC-Rio.

Cedrim, D. (2018).Understanding and Improving Batch Refactoring in Software Systems. PhD thesis, Informatics Department (DI), Pontifical Catholic University of Rio de Janeiro (PUC-Rio), Brazil.

Cedrim, D., Garcia, A., Mongiovi, M., Gheyi, R., Sousa, L., de Mello, R., Fonseca,B., Ribeiro, M., and Chavez, A. (2017). Understanding the impact of refactoringon smells: A longitudinal study of 23 software projects. In Proceedings of the 11th Joint Meeting of the European Software Engineering Conference and the ACM Sigsoft Symposium on the Foundations of Software (ESEC/FSE), pages 465–475.

Chavez, A., Ferreira, I., Fernandes, E., Cedrim, D., and Garcia, A. (2017). How does refactoring affect internal quality attributes? A multi-project study. In Proceedings of the 31st Brazilian Symposium on Software Engineering (SBES), pages 74–83.

de Oliveira, M. C. (2017). DRACO: Discovering refactorings that improve architecture using fine-grained co-change dependencies. In Proceedings of the 11th Joint Meeting on Foundations of Software Engineering (FSE), pages 1018–1021.

Fernandes, E., Uchoa, A., Bibiano, A. C., and Garcia, A. (2019). On the alternatives for composing batch refactoring. In Proceedings of the 3rd International Workshop on Refactoring (IWoR), co-located with the 41st International Conference on Software Engineering (ICSE), pages 1–4.

Ferreira, I., Fernandes, E., Cedrim, D., Uchˆoa, A., Bibiano, A. C., Garcia, A., Correia,J. L., Santos, F., Nunes, G., Barbosa, C., et al. (2018). The buggy side of code refac-toring: Understanding the relationship between refactorings and bugs. In Proceedings of the 40th International Conference on Software Engineering (ICSE): Poster Track, pages 406–407.

Fowler, M. (1999).Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, 1st edition.

Kang, K., Cohen, S., Hess, J., Novak, W., and Peterson, A. (1990). Feature-oriented domain analysis (FODA) feasibility study. Technical report, CMU-SEI-90-TR-21 and ESD-90-TR-222, Software Engineering Insttitute (SEI), Carnegie Mellon University(CMU).

Kim, J., Batory, D., Dig, D., and Azanza, M. (2016). Improving refactoring speed by 10x.InProceedings of the 38th International Conference on Software Engineering (ICSE),pages 1145–1156.

Kim, M., Zimmermann, T., and Nagappan, N. (2014). An empirical study of refactoring: Challenges and benefits at Microsoft. IEEE Transactions on Software Engineering(TSE), 40(7):633–649.

Kitchenham, B. and Charters, S. (2007). Guidelines for performing systematic literature reviews in software engineering. Technical report, EBSE 2007-001, Version 2.3, Keele University and University of Durham.

Kuhlemann, M., Liang, L., and Saake, G. (2010). Algebraic and cost-based optimization of refactoring sequences. In Proceedings of the 2nd International Workshop on Model-driven Product Line Engineering (MDPLE), co-located with the 6th European Conference on Modelling Foundations and Applications (ECMFA), pages 37–48.

Lin, Y., Peng, X., Cai, Y., Dig, D., Zheng, D., and Zhao, W. (2016). Interactive and guided architectural refactoring with search-based recommendation. In Proceedings of the 24th International Symposium on Foundations of Software Engineering (FSE),pages 535–546.

Meananeatra, P. (2012). Identifying refactoring sequences for improving software maintainability. In Proceedings of the 27th International Conference on Automated Soft-ware Engineering (ASE), pages 406–409.

Mkaouer, M. W., Kessentini, M., Bechikh, S., Deb, K., and ́O Cinneide, M. (2014). Recommendation system for software refactoring using innovization and interactive dynamic optimization. In Proceedings of the 29th International Conference on Automated Software Engineering (ASE), pages 331–336.

Murphy-Hill, E., Parnin, C., and Black, A. (2012). How we refactor, and how we know it.IEEE Transactions on Software Engineering (TSE), 38(1):5–18.

́O Cinneide, M., Tratt, L., Harman, M., Counsell, S., and Hemati Moghadam, I. (2012).Experimental assessment of software metrics using automated refactoring. In Proceedings of the 5th International Symposium on Empirical Software Engineering andMeasurement (ESEM), pages 49–58.

Ouni, A., Kessentini, M., and Sahraoui, H. (2013a). Search-based refactoring using recorded code changes. InProceedings of the 17th European Conference on Software Maintenance and Reengineering (CSMR), pages 221–230.

Ouni, A., Kessentini, M., Sahraoui, H., and Hamdi, M. S. (2013b). The use of development history in software refactoring using a multi-objective evolutionary algorithm. InProceedings of the 15th Genetic and Evolutionary Computation Conference (GECCO),pages 1461–1468.

Paixao, M., Krinke, J., Han, D., Ragkhitwetsagul, C., and Harman, M. (2017). Are developers aware of the architectural impact of their changes? In Proceedings of the 32nd International Conference on Automated Software Engineering (ASE), pages 95–105.

Paixao, M., Uchoa, A., Bibiano, A. C., Oliveira, D., Garcia, A., Krinke, J., and Arvonio,E. (2020). Behind the intents: An in-depth empirical study on software refactoring in modern code review. In17th Mining Software Repositories (MSR).

Piveta, E., Araujo, J., Pimenta, M., Moreira, A., Guerreiro, P., and Price, R. T. (2008).Searching for opportunities of refactoring sequences: Reducing the search space. InProceedings of the 32nd International Conference on Computer Software and Appli-cations (COMPSAC), pages 319–326.

Qayum, F., Heckel, R., Corradini, A., Margaria, T., Padberg, J., and Taentzer, G. (2010).Search-based refactoring based on unfolding of graph transformation systems. In Proceedings of the 5th International Conference on Graph Transformation (ICGT): Doctoral Symposium (DS), pages 1–14.

Raychev, V., Schafer, M., Sridharan, M., and Vechev, M. (2013). Refactoring with synthesis. ACM SIGPLAN Notices, 48(10):339–354.

Sousa, L., Cedrim, D., Garcia, A., Oizumi, W., Bibiano, A. C., Tenorio, D., Kim, M., and Oliveira, A. (2020). Characterizing and identifying composite refactorings: Concepts, heuristics and patterns. In17th Mining Software Repositories (MSR).

Szoke, G., Nagy, C., F ̈ul ̈op, L., Ferenc, R., and Gyim othy, T. (2015). FaultBuster: An automatic code smell refactoring toolset. In Proceedings of the 15th Working Conference on Source Code Analysis and Manipulation (SCAM), pages 253–258.

Tenorio, D., Bibiano, A. C., and Garcia, A. (2019). On the customization of batch refac-toring. In 3rd International Workshop on Refactoring, co-alocated International Conference on Software Engineering (ICSE), pages 13–16. IEEE Press.

Tsantalis, N. and Chatzigeorgiou, A. (2011). Identification of extract method refactoring opportunities for the decomposition of methods. Journal of Systems and Software(JSS), 84(10):1757–1782.

Tsantalis, N., Mansouri, M., Eshkevari, L., Mazinanian, D., and Dig, D. (2018). Accurate and efficient refactoring detection in commit history. In 40th International Conference on Software Engineering (ICSE), pages 483–494.

Yamashita, A. and Moonen, L. (2012). Do code smells reflect important maintainability aspects? In Proceedings of the 28th International Conference on Software Maintenance (ICSM), pages 306–315.
Publicado
19/10/2020
Como Citar

Selecione um Formato
BIBIANO, Ana Carla; GARCIA, Alessandro. On the Characterization, Detection and Impact of Batch Refactoring in Practice. In: CONCURSO DE TESES E DISSERTAÇÕES EM ENGENHARIA DE SOFTWARE (CTD-ES) - CONGRESSO BRASILEIRO DE SOFTWARE: TEORIA E PRÁTICA (CBSOFT), 11. , 2020, Evento Online. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2020 . p. 165-179. DOI: https://doi.org/10.5753/cbsoft_estendido.2020.14626.