Learning to Recommend Method Names with Global Context
Fang Liu, Ge Li, Zhiyi Fu, Shuai Lu, Yiyang Hao, Zhi Jin

TL;DR
This paper introduces GTNM, a global transformer model that leverages local, project-specific, and documentation contexts to improve method name suggestions, significantly outperforming existing neural models.
Contribution
The paper proposes a novel global transformer-based model that incorporates multiple contextual sources for method name prediction, advancing beyond prior models that focus only on code-specific features.
Findings
GTNM outperforms state-of-the-art models on Java method name prediction.
Incorporating multiple contexts improves suggestion accuracy.
Experimental results demonstrate the effectiveness of the proposed approach.
Abstract
In programming, the names for the program entities, especially for the methods, are the intuitive characteristic for understanding the functionality of the code. To ensure the readability and maintainability of the programs, method names should be named properly. Specifically, the names should be meaningful and consistent with other names used in related contexts in their codebase. In recent years, many automated approaches are proposed to suggest consistent names for methods, among which neural machine translation (NMT) based models are widely used and have achieved state-of-the-art results. However, these NMT-based models mainly focus on extracting the code-specific features from the method body or the surrounding methods, the project-specific context and documentation of the target method are ignored. We conduct a statistical analysis to explore the relationship between the method…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Software System Performance and Reliability
