paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Context-Based Automated Approach for Method Name Consistency Checking and Suggestion

基于上下文的自动化方法名一致性检查与建议方法
ICSE 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE)2021匹配度 2/10 · 该论文利用 RNN 编码器-解码器进行方法名一致性检测与推荐,属于深度学习辅助软件开发/代码理解,未涉及用户画像核心的静态分析、Agentic/LLM 程序、浮点程序分析或贝叶斯程序分析。虽然结合了机器学习与程序语言,但方法较旧且任务与研究方向距离较远。引用 40 inbox
Yi Li, Shaohua Wang, Tien Nguyen
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 DeepName,利用方法上下文与 RNN 编码器-解码器检测方法名不一致,并推荐更合适的方法名。

软件中误导性方法名会困惑开发者并影响可理解性。DeepName 基于“观其友知其人”思想,除方法体外还利用当前方法与调用者、被调用者及同类兄弟方法的交互,将名称子词序列输入 RNN 编码器-解码器,并配合复制与非复制机制生成方法表示,用于一致性检查与名称建议。在 1400 万+方法数据集上,一致性检查的 recall、precision、F-score 相对提升 2.1%、19.6%、11.9%;名称建议的 precision 提升 1.8%–30.5%。在活跃项目的 50 个 PR 中 12 个被合并,30/50 例团队认为建议名更有意义。

问题
软件项目中误导性方法名会令开发者困惑,可能导致缺陷并降低代码可理解性;现有工作主要依据方法体,忽略方法间上下文。
方法
提出 DeepName,利用调用者、被调用者和同类兄弟方法等上下文中的名称子词序列,通过带复制与非复制机制的 RNN 编码器-解码器生成方法表示,检测不一致并建议名称。
评估
在含 1400 万+方法的数据集上比较一致性检查与名称建议指标,并在活跃项目提交 50 个 pull request 考察实用性。
原文摘要(Abstract)

Misleading method names in software projects can confuse developers, which may lead to software defects and affect code understandability. In this paper, we present DeepName, a context-based, deep learning approach to detect method name inconsistencies and suggest a proper name for a method. The key departure point is the philosophy of "Show Me Your Friends, I'll Tell You Who You Are". Unlike the state-of-the-art approaches, in addition to the method's body, we also consider the interactions of the current method under study with the other ones including the caller and callee methods, and the sibling methods in the same enclosing class. The sequences of sub-tokens in the program entities' names in the contexts are extracted and used as the input for an RNN-based encoder-decoder to produce the representations for the current method. We modify that RNN model to integrate the copy mechanism and our newly developed component, called the non-copy mechanism, to emphasize on the possibility of a certain sub-token not to be copied to follow the current sub-token in the currently generated method name. We conducted several experiments to evaluate DeepName on large datasets with +14M methods. For consistency checking, DeepName improves the state-of-the-art approach by 2.1%, 19.6%, and 11.9% relatively in recall, precision, and F-score, respectively. For name suggestion, DeepName improves relatively over the state-of-the-art approaches in precision (1.8%–30.5%), recall (8.8%–46.1%), and F-score (5.2%–38.2%). To assess DeepName's usefulness, we detected inconsistent methods and suggested new method names in active projects. Among 50 pull requests, 12 were merged into the main branch. In total, in 30/50 cases, the team members agree that our suggested method names are more meaningful than the current names.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{Li0N21,
  title = {A Context-Based Automated Approach for Method Name Consistency Checking and Suggestion},
  author = {Yi Li and Shaohua Wang and Tien Nguyen},
  booktitle = {ICSE},
  year = {2021},
  doi = {10.1109/icse43902.2021.00060}
}