Enhancing structural knowledge in code smell identification: A fusion learning framework combining AST-based metrics with semantic embeddings

IF 7.5 1区 计算机科学 Q1 COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE
Quanxin Yang , Dongjin Yu , Sixuan Wang , Yihang Xu , Xin Chen , Jie Chen , Bin Hu
{"title":"Enhancing structural knowledge in code smell identification: A fusion learning framework combining AST-based metrics with semantic embeddings","authors":"Quanxin Yang ,&nbsp;Dongjin Yu ,&nbsp;Sixuan Wang ,&nbsp;Yihang Xu ,&nbsp;Xin Chen ,&nbsp;Jie Chen ,&nbsp;Bin Hu","doi":"10.1016/j.eswa.2024.125725","DOIUrl":null,"url":null,"abstract":"<div><div>Identifying code smells is a crucial task in software engineering that aims to uncover potential problems and bad practices in source code. Existing learning-based approaches have achieved good results in identifying code smells by learning features such as software code metrics, syntax, and semantics. However, some gaps in existing research still need to be addressed: (1) Software code metrics are challenging to extract and vary across different levels of code granularity; (2) Highly abstract code semantics rarely convey the structural details of the code. To address these issues, we propose using Abstract Syntax Tree (AST)-based metrics to replace software code metrics for identifying code smells. The proposed AST-based metrics are easy to extract, treat code at all granularity levels uniformly, and precisely describe the structural details of the code. Additionally, we propose a fusion learning framework that combines AST-based metrics and semantic embeddings to identify code smells and their severity. Extensive experimental results reveal that our proposed AST-based metrics have the potential to replace software code metrics in identifying code smells, and the proposed fusion learning framework outperforms state-of-the-art approaches on the same dataset.</div></div>","PeriodicalId":50461,"journal":{"name":"Expert Systems with Applications","volume":"263 ","pages":"Article 125725"},"PeriodicalIF":7.5000,"publicationDate":"2024-11-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Expert Systems with Applications","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0957417424025922","RegionNum":1,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE","Score":null,"Total":0}
引用次数: 0

Abstract

Identifying code smells is a crucial task in software engineering that aims to uncover potential problems and bad practices in source code. Existing learning-based approaches have achieved good results in identifying code smells by learning features such as software code metrics, syntax, and semantics. However, some gaps in existing research still need to be addressed: (1) Software code metrics are challenging to extract and vary across different levels of code granularity; (2) Highly abstract code semantics rarely convey the structural details of the code. To address these issues, we propose using Abstract Syntax Tree (AST)-based metrics to replace software code metrics for identifying code smells. The proposed AST-based metrics are easy to extract, treat code at all granularity levels uniformly, and precisely describe the structural details of the code. Additionally, we propose a fusion learning framework that combines AST-based metrics and semantic embeddings to identify code smells and their severity. Extensive experimental results reveal that our proposed AST-based metrics have the potential to replace software code metrics in identifying code smells, and the proposed fusion learning framework outperforms state-of-the-art approaches on the same dataset.
增强代码气味识别中的结构知识:基于 AST 的指标与语义嵌入相结合的融合学习框架
识别代码气味是软件工程中的一项重要任务,旨在发现源代码中的潜在问题和不良做法。现有的基于学习的方法通过学习软件代码度量、语法和语义等特征,在识别代码气味方面取得了良好的效果。然而,现有研究中仍有一些不足之处需要解决:(1) 软件代码度量标准的提取具有挑战性,并且在不同层次的代码粒度中存在差异;(2) 高度抽象的代码语义很少能传达代码的结构细节。为解决这些问题,我们建议使用基于抽象语法树(AST)的度量标准来替代软件代码度量标准,以识别代码气味。所提出的基于 AST 的度量标准易于提取,能统一处理所有粒度级别的代码,并能精确描述代码的结构细节。此外,我们还提出了一种融合学习框架,将基于 AST 的度量标准与语义嵌入相结合,以识别代码气味及其严重程度。广泛的实验结果表明,我们提出的基于 AST 的度量标准有可能取代软件代码度量标准来识别代码气味,而且在相同的数据集上,我们提出的融合学习框架优于最先进的方法。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Expert Systems with Applications
Expert Systems with Applications 工程技术-工程:电子与电气
CiteScore
13.80
自引率
10.60%
发文量
2045
审稿时长
8.7 months
期刊介绍: Expert Systems With Applications is an international journal dedicated to the exchange of information on expert and intelligent systems used globally in industry, government, and universities. The journal emphasizes original papers covering the design, development, testing, implementation, and management of these systems, offering practical guidelines. It spans various sectors such as finance, engineering, marketing, law, project management, information management, medicine, and more. The journal also welcomes papers on multi-agent systems, knowledge management, neural networks, knowledge discovery, data mining, and other related areas, excluding applications to military/defense systems.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信