Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração

Carregando...
Imagem de Miniatura

Título da Revista

ISSN da Revista

Título de Volume

Editor

Universidade Federal de São Carlos

Resumo

Software systems must continually evolve to remain useful, but this evolution often increases complexity and degrades quality, making refactoring essential for long-term maintainability. Despite significant research on automated refactoring recommendations, existing approaches remain limited: the vast majority focus on solving specific problems like code smells or rely on software metrics, while neglecting the rich semantic and syntactic representations of source code. Moreover, they usually provide partial support, such as identifying where to refactor without specifying what refactoring to apply or suggesting a refactoring type without clarifying its rationale. This narrow scope not only overlooks diverse and real refactoring needs but also undermines developer trust, reducing the practical usefulness of such tools. This work addresses these limitations by proposing an artificial intelligence–based approach for generating complete recommendations for Extract Method refactoring. Grounded in real refactorings applied in the past of the projects and leveraging the semantic representation of code, the approach delivers recommendations that explicitly cover the W3B criteria, developed in this work: Which refactoring to apply, Where in the code it should be applied, Why it is suggested, and the Benefits it brings. The methodology followed a multi-phase pipeline. First, a specialized dataset of Extract Method samples was systematically built. Second, a recommendation model was developed by fine-tuning CodeBERT to measure the affinity between candidate fragments and the analyzed method. Third, a consensus-based explainer was designed, aggregating outputs from SHAP, LIME, and ANCHOR with a Random Forest surrogate to provide interpretable explanations. Finally, the outputs of all phases were integrated into a concluding phase, completing the proposed approach and delivering complete and interpretable Extract Method recommendations. Evaluation was conducted through a controlled experiment with postgraduate students (7 participants out of 9 initially enrolled), who provided a total of 24 evaluations by assessing more than one method each. Results showed a statistically significant improvement in participants’ confidence scores (p = 0.011), strong alignment between tool suggestions and participants’ own choices (57.7%), and high agreement (96%) with the stated benefits, including readability, modularity, and maintainability.

Descrição

Citação

ARMIJO, Guisella Clara Angulo. Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração. 2025. Tese (Doutorado em Ciência da Computação) – Universidade Federal de São Carlos, São Carlos, 2025. Disponível em: https://repositorio.ufscar.br/handle/20.500.14289/23207.

item.page.endorsement

item.page.review

item.page.supplemented

item.page.referenced

Licença Creative Commons

Exceto quando indicado de outra forma, a licença deste item é descrita como Attribution-NonCommercial-NoDerivs 3.0 Brazil