Minerando Motivações para Aplicação de Extract Method: Um Estudo Preliminar

  • Jalisson Henrique UFBA
  • Marcos Dósea UFS
  • Cláudio Sant’Anna UFBA

Resumo


As refatorações são operações realizadas no código fonte visando melhorar a capacidade de manutenção de um sistema de software. Apesar da literatura conter diversos estudos sobre as refatorações, são poucos os trabalhos que investigaram as motivações para tais refatorações ocorrerem. Esta pesquisa buscou investigar as motivações por trás das operações de extract method em um sistema real. Para isso, um estudo experimental foi conduzido, buscando minerar as refatorações do tipo extract method e analisar as mensagens de commit visando capturar as motivações por trás das refatorações. Também foi verificado a relação entre as refatorações e a métrica de número de linhas de código (LOC). Os resultados apontaram 11 motivações diferentes para a utilização do extract method. Além disso, foi visto que apenas 35% das refatorações que ocorreram foram com intenção de melhorar a qualidade do código. Também foi identificado que as refatorações com intenção de melhorar a qualidade do código ocorreram com maior frequência em métodos com valores de LOC na faixa de 21 a 40 e foram menos frequentes em métodos com valores entre 61 a 80.

Palavras-chave: Refatoração, Extract Method, Métricas de código

Referências

E. AlOmar, M.W. Mkaouer, and A. Ouni. 2019. Can Refactoring Be Self-Affirmed? An Exploratory Study on How Developers Document Their Refactoring Activities in Commit Messages. In 2019 IEEE/ACM 3rd InternationalWorkshop on Refactoring (IWoR). 51–58. https://doi.org/10.1109/IWoR.2019.00017

D. S. Cruzes and T. Dyba. 2011. Recommended Steps for Thematic Synthesis in Software Engineering. In 2011 International Symposium on Empirical Software Engineering and Measurement. 275–284. https://doi.org/10.1109/ESEM.2011.36

B. Du Bois, S. Demeyer, and J. Verelst. 2005. Does the "Refactor to Understand" reverse engineering pattern improve program comprehension?. In Ninth European Conference on Software Maintenance and Reengineering. 334–343. https://doi.org/10.1109/CSMR.2005.25

R. Eckart de Castilho, E. Mújdricza-Maydt, S. Muhie, S. Hartmann, I. Gurevych, A. Frank, and C. Biemann. 2016. AWeb-based Tool for the Integrated Annotation of Semantic and Syntactic Structures. The COLING 2016 Organizing Committee, Osaka, Japan, 76–84.

M. Fowler. 1999. Refactoring: Improving the Design of Existing Code. Addison-Wesley Longman Publishing Co., Inc., USA.

W. Liu and H. Liu. 2016. Major motivations for extract method refactorings: analysis based on interviews and change histories. Frontiers of Computer Science 10, 4 (2016), 644–656.

T. Mens and T. Tourwe. 2004. A survey of software refactoring. IEEE Transactions on Software Engineering 30, 2 (2004), 126–139. https://doi.org/10.1109/TSE.2004.1265817

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

M. Paixão, A. Uchôa, A. C. Bibiano,D. Oliveira, A. Garcia, J. Krinke, and E. Arvonio. 2020. Behind the Intents: An In-Depth Empirical Study on Software Refactoring in Modern Code Review. In Proceedings of the 17th International Conference on Mining Software Repositories. Association for Computing Machinery, 12. https://doi.org/10.1145/3379597.3387475

S. Rebai, M. Kessentini, V. Alizadeh, O. Ben Sghaier, and R. Kazman. 2020. Recommending refactorings via commit message analysis. Information and Software Technology 126 (2020), 106332. https://doi.org/10.1016/j.infsof.2020.106332

D. Silva, N. Tsantalis, and M. T. Valente. 2016. Why We Refactor? Confessions of GitHub Contributors. In Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering (Seattle, WA, USA) (FSE 2016). Association for Computing Machinery, New York, NY, USA, 858–870.

N. Tsantalis, A. Ketkar, and D. Dig. 2020. RefactoringMiner 2.0. IEEE Transactions on Software Engineering (2020), 1–1.

M. T. Valente. 2020. Engenharia de Software Moderna. Independente. https://engsoftmoderna.info/
Publicado
27/09/2021
Como Citar

Selecione um Formato
HENRIQUE, Jalisson; DÓSEA, Marcos; SANT’ANNA, Cláudio. Minerando Motivações para Aplicação de Extract Method: Um Estudo Preliminar. In: WORKSHOP DE VISUALIZAÇÃO, EVOLUÇÃO E MANUTENÇÃO DE SOFTWARE (VEM), 9. , 2021, Joinville. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2021 . p. 21-25. DOI: https://doi.org/10.5753/vem.2021.17212.