A Context-based Automated Approach for Method Name Consistency Checking and Suggestion
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). First posted on arXiv 27 Feb 2021.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 1; 2022: 1; 2023: 1; 2024: 1; 2025: 1.
5 papers.
- 2021A Survey on Machine Learning Techniques for Source Code Analysiscited by 24
- 2024An Empirical Study on Capability of Large Language Models in Understanding Code Semanticscited by 7
- 2023Revisiting File Context for Source Code Summarizationcited by 3
- 2022JEMMA: An Extensible Java Dataset for ML4Code Applicationscited by 2
- 2025Deep Learning-Based Identification of Inconsistent Method Names: How Far Are We?cited by 2
- 2025Deep Learning-Based Identification of Inconsistent Method Names: How Far Are We?22 Jan 2025
- 2024An Empirical Study on Capability of Large Language Models in Understanding Code Semantics4 Jul 2024
- 2023Revisiting File Context for Source Code Summarization5 Sep 2023
- 2022JEMMA: An Extensible Java Dataset for ML4Code Applications18 Dec 2022
- 2021A Survey on Machine Learning Techniques for Source Code Analysis18 Oct 2021