Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração
| Ano de defesa: | 2025 |
|---|---|
| Autor(a) principal: | |
| Orientador(a): | |
| Banca de defesa: | |
| Tipo de documento: | Tese |
| Tipo de acesso: | Acesso aberto |
| Idioma: | eng |
| Instituição de defesa: |
Universidade Federal de São Carlos
Câmpus São Carlos |
| Programa de Pós-Graduação: |
Programa de Pós-Graduação em Ciência da Computação - PPGCC
|
| Departamento: |
Não Informado pela instituição
|
| País: |
Não Informado pela instituição
|
| Palavras-chave em Português: | |
| Palavras-chave em Inglês: | |
| Área do conhecimento CNPq: | |
| Link de acesso: | https://hdl.handle.net/20.500.14289/23207 |
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. |
| id |
SCAR_e5291cee88c5e8d6919cb9a196a76c13 |
|---|---|
| oai_identifier_str |
oai:repositorio.ufscar.br:20.500.14289/23207 |
| network_acronym_str |
SCAR |
| network_name_str |
Repositório Institucional da UFSCAR |
| repository_id_str |
|
| spelling |
Armijo, Guisella Clara AnguloCamargo, Valter Vieira dehttp://lattes.cnpq.br/6809743774407662http://lattes.cnpq.br/2292043446906539https://orcid.org/0000-0003-1898-4039https://orcid.org/0000-0002-6439-4649https://orcid.org/0000-0002-6004-2718https://orcid.org/0000-0001-9943-5570https://orcid.org/0000-0002-9046-9499https://orcid.org/0000-0002-1360-4036Figueiredo, Eduardo LagesWiese, Igor ScalianteValejo, Alan Demetrius BariaLucrédio, Danielhttp://lattes.cnpq.br/1265706528850746http://lattes.cnpq.br/0447444423694007http://lattes.cnpq.br/9546164790189830http://lattes.cnpq.br/90903965595962212025-12-15T13:04:51Z2025-10-08ARMIJO, 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.https://hdl.handle.net/20.500.14289/23207Software 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.Sistemas de software devem evoluir continuamente para permanecer úteis, mas essa evolução frequentemente aumenta a complexidade e degrada a qualidade, tornando a refatoração essencial para a manutenção a longo prazo. Apesar das pesquisas em recomendações automáticas de refatoração, as abordagens existentes permanecem limitadas: em sua maioria tratam apenas de problemas específicos, como code smells, ou dependem de métricas de software, negligenciando as ricas representações semânticas e sintáticas do código-fonte. Além disso, geralmente oferecem apenas suporte parcial, como indicar onde refatorar sem especificar a ação a aplicar, ou sugerir um tipo de refatoração sem esclarecer sua justificativa. Esse escopo restrito ignora necessidades reais de refatoração e reduz a confiança dos desenvolvedores, comprometendo a utilidade prática. Este trabalho enfrenta essas limitações ao propor uma abordagem baseada em inteligência artificial para gerar recomendações completas de Extract Method. Fundamentada em refatorações históricas extraídas de projetos e representações semântica do código, a abordagem fornece recomendações que contemplam os critérios W3B, desenvolvidos nesta tese: Which (ação a aplicar), Where (onde aplicar), Why (por que é sugerida) e Benefits (benefícios obtidos). A metodologia seguiu um pipeline em múltiplas fases. Primeiro, foi construído de forma sistemática um conjunto especializado de exemplos de Extract Method a partir de repositórios de código aberto. Em seguida, desenvolveu-se um modelo de recomendação ajustando o CodeBERT para medir a afinidade entre fragmentos candidatos e o método analisado. Na terceira fase, foi projetado um explicador baseado em consenso, combinando SHAP, LIME e ANCHOR com um modelo substituto Random Forest para gerar explicações interpretáveis. Por fim, as saídas das fases foram integradas, concluindo a abordagem proposta e fornecendo recomendações completas e interpretáveis de Extract Method. A avaliação foi conduzida em um experimento controlado com pós-graduandos (7 participantes), que realizaram 24 avaliações ao analisar mais de um método cada. Os resultados mostraram melhora estatisticamente significativa nos escores de confiança (p = 0,011), forte alinhamento entre as sugestões da ferramenta e as escolhas dos participantes (57,7%) e alta concordância (96%) quanto aos benefícios apontados, incluindo legibilidade, modularidade e manutenibilidade.Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES)engUniversidade Federal de São CarlosCâmpus São CarlosPrograma de Pós-Graduação em Ciência da Computação - PPGCCUFSCarAttribution-NonCommercial-NoDerivs 3.0 Brazilhttp://creativecommons.org/licenses/by-nc-nd/3.0/br/info:eu-repo/semantics/openAccessRefactoring RecommendationsArtificial IntelligenceExplainable AI (XAI)CIENCIAS EXATAS E DA TERRA::CIENCIA DA COMPUTACAO::METODOLOGIA E TECNICAS DA COMPUTACAO9. Indústria, Inovação e InfraestruturaRecomendação de RefatoraçõesInteligência ArtificialExplicável IAUma abordagem baseada em inteligência artificial para recomendações completas de método de extraçãoAn artificial intelligence–based approach for complete extract method recommendationsinfo:eu-repo/semantics/publishedVersioninfo:eu-repo/semantics/doctoralThesisreponame:Repositório Institucional da UFSCARinstname:Universidade Federal de São Carlos (UFSCAR)instacron:UFSCARCC-LICENSElicense_rdflicense_rdfapplication/rdf+xml; charset=utf-8906https://repositorio.ufscar.br/bitstreams/9153f185-140f-4c89-8508-e594fa60bc33/downloadfba754f0467e45ac3862bc2533fb2736MD52falseAnonymousREADORIGINALTeseDoutoradoGuisellaAnguloArmijo.pdfTeseDoutoradoGuisellaAnguloArmijo.pdfapplication/pdf4264066https://repositorio.ufscar.br/bitstreams/3c7bae14-9278-4e96-9529-c098bb6ba405/download92b09ecb1937f6eb4260a09228cbcddeMD53trueAnonymousREADTEXTTeseDoutoradoGuisellaAnguloArmijo.pdf.txtTeseDoutoradoGuisellaAnguloArmijo.pdf.txtExtracted texttext/plain100516https://repositorio.ufscar.br/bitstreams/9a9c36e5-d0c5-48ad-ae5b-c2b250f5de00/downloadfc1218e2cc54c5e657b2f6bae6228de6MD54falseAnonymousREADTHUMBNAILTeseDoutoradoGuisellaAnguloArmijo.pdf.jpgTeseDoutoradoGuisellaAnguloArmijo.pdf.jpgGenerated Thumbnailimage/jpeg5531https://repositorio.ufscar.br/bitstreams/c05f61cd-ccb0-4f14-b023-b5eedd86cfc3/download6cd770bc56f596b23ca4c6a24dfbf80aMD55falseAnonymousREAD20.500.14289/232072025-12-16T03:06:35.617431Zhttp://creativecommons.org/licenses/by-nc-nd/3.0/br/Attribution-NonCommercial-NoDerivs 3.0 Brazilopen.accessoai:repositorio.ufscar.br:20.500.14289/23207https://repositorio.ufscar.brRepositório InstitucionalPUBhttps://repositorio.ufscar.br/oai/requestrepositorio.sibi@ufscar.bropendoar:43222025-12-16T03:06:35Repositório Institucional da UFSCAR - Universidade Federal de São Carlos (UFSCAR)false |
| dc.title.none.fl_str_mv |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| dc.title.alternative.eng.fl_str_mv |
An artificial intelligence–based approach for complete extract method recommendations |
| title |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| spellingShingle |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração Armijo, Guisella Clara Angulo Refactoring Recommendations Artificial Intelligence Explainable AI (XAI) CIENCIAS EXATAS E DA TERRA::CIENCIA DA COMPUTACAO::METODOLOGIA E TECNICAS DA COMPUTACAO Recomendação de Refatorações Inteligência Artificial Explicável IA 9. Indústria, Inovação e Infraestrutura |
| title_short |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| title_full |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| title_fullStr |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| title_full_unstemmed |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| title_sort |
Uma abordagem baseada em inteligência artificial para recomendações completas de método de extração |
| author |
Armijo, Guisella Clara Angulo |
| author_facet |
Armijo, Guisella Clara Angulo |
| author_role |
author |
| dc.contributor.authorlattes.none.fl_str_mv |
http://lattes.cnpq.br/2292043446906539 |
| dc.contributor.authororcid.none.fl_str_mv |
https://orcid.org/0000-0003-1898-4039 |
| dc.contributor.advisor1orcid.none.fl_str_mv |
https://orcid.org/0000-0002-6439-4649 |
| dc.contributor.refereeorcid.none.fl_str_mv |
https://orcid.org/0000-0002-6004-2718 https://orcid.org/0000-0001-9943-5570 https://orcid.org/0000-0002-9046-9499 https://orcid.org/0000-0002-1360-4036 |
| dc.contributor.referee.none.fl_str_mv |
Figueiredo, Eduardo Lages Wiese, Igor Scaliante Valejo, Alan Demetrius Baria Lucrédio, Daniel |
| dc.contributor.refereeLattes.none.fl_str_mv |
http://lattes.cnpq.br/1265706528850746 http://lattes.cnpq.br/0447444423694007 http://lattes.cnpq.br/9546164790189830 http://lattes.cnpq.br/9090396559596221 |
| dc.contributor.author.fl_str_mv |
Armijo, Guisella Clara Angulo |
| dc.contributor.advisor1.fl_str_mv |
Camargo, Valter Vieira de |
| dc.contributor.advisor1Lattes.fl_str_mv |
http://lattes.cnpq.br/6809743774407662 |
| contributor_str_mv |
Camargo, Valter Vieira de |
| dc.subject.eng.fl_str_mv |
Refactoring Recommendations Artificial Intelligence Explainable AI (XAI) |
| topic |
Refactoring Recommendations Artificial Intelligence Explainable AI (XAI) CIENCIAS EXATAS E DA TERRA::CIENCIA DA COMPUTACAO::METODOLOGIA E TECNICAS DA COMPUTACAO Recomendação de Refatorações Inteligência Artificial Explicável IA 9. Indústria, Inovação e Infraestrutura |
| dc.subject.cnpq.fl_str_mv |
CIENCIAS EXATAS E DA TERRA::CIENCIA DA COMPUTACAO::METODOLOGIA E TECNICAS DA COMPUTACAO |
| dc.subject.por.fl_str_mv |
Recomendação de Refatorações Inteligência Artificial Explicável IA |
| dc.subject.ods.none.fl_str_mv |
9. Indústria, Inovação e Infraestrutura |
| description |
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. |
| publishDate |
2025 |
| dc.date.accessioned.fl_str_mv |
2025-12-15T13:04:51Z |
| dc.date.issued.fl_str_mv |
2025-10-08 |
| dc.type.status.fl_str_mv |
info:eu-repo/semantics/publishedVersion |
| dc.type.driver.fl_str_mv |
info:eu-repo/semantics/doctoralThesis |
| format |
doctoralThesis |
| status_str |
publishedVersion |
| dc.identifier.citation.fl_str_mv |
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. |
| dc.identifier.uri.fl_str_mv |
https://hdl.handle.net/20.500.14289/23207 |
| identifier_str_mv |
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. |
| url |
https://hdl.handle.net/20.500.14289/23207 |
| dc.language.iso.fl_str_mv |
eng |
| language |
eng |
| dc.rights.driver.fl_str_mv |
Attribution-NonCommercial-NoDerivs 3.0 Brazil http://creativecommons.org/licenses/by-nc-nd/3.0/br/ info:eu-repo/semantics/openAccess |
| rights_invalid_str_mv |
Attribution-NonCommercial-NoDerivs 3.0 Brazil http://creativecommons.org/licenses/by-nc-nd/3.0/br/ |
| eu_rights_str_mv |
openAccess |
| dc.publisher.none.fl_str_mv |
Universidade Federal de São Carlos Câmpus São Carlos |
| dc.publisher.program.fl_str_mv |
Programa de Pós-Graduação em Ciência da Computação - PPGCC |
| dc.publisher.initials.fl_str_mv |
UFSCar |
| publisher.none.fl_str_mv |
Universidade Federal de São Carlos Câmpus São Carlos |
| dc.source.none.fl_str_mv |
reponame:Repositório Institucional da UFSCAR instname:Universidade Federal de São Carlos (UFSCAR) instacron:UFSCAR |
| instname_str |
Universidade Federal de São Carlos (UFSCAR) |
| instacron_str |
UFSCAR |
| institution |
UFSCAR |
| reponame_str |
Repositório Institucional da UFSCAR |
| collection |
Repositório Institucional da UFSCAR |
| bitstream.url.fl_str_mv |
https://repositorio.ufscar.br/bitstreams/9153f185-140f-4c89-8508-e594fa60bc33/download https://repositorio.ufscar.br/bitstreams/3c7bae14-9278-4e96-9529-c098bb6ba405/download https://repositorio.ufscar.br/bitstreams/9a9c36e5-d0c5-48ad-ae5b-c2b250f5de00/download https://repositorio.ufscar.br/bitstreams/c05f61cd-ccb0-4f14-b023-b5eedd86cfc3/download |
| bitstream.checksum.fl_str_mv |
fba754f0467e45ac3862bc2533fb2736 92b09ecb1937f6eb4260a09228cbcdde fc1218e2cc54c5e657b2f6bae6228de6 6cd770bc56f596b23ca4c6a24dfbf80a |
| bitstream.checksumAlgorithm.fl_str_mv |
MD5 MD5 MD5 MD5 |
| repository.name.fl_str_mv |
Repositório Institucional da UFSCAR - Universidade Federal de São Carlos (UFSCAR) |
| repository.mail.fl_str_mv |
repositorio.sibi@ufscar.br |
| _version_ |
1853669973093777408 |