Lightweight Global and Local Contexts Guided Method Name Recommendation with Prior Knowledge
Thu 26 Aug 2021 23:00 - 23:10 - Analytics & Software Evolution—Program Comprehension Chair(s): Venera Arnaoudova, Bonita Sharif
The quality of method names is critical for the readability and maintainability of source code. However, it is often challenging to construct concise method names. To alleviate this problem, a number of approaches have been proposed to automatically recommend high-quality names for methods.
Despite being effective, existing approaches meet their bottlenecks mainly in two aspects: (1) the leveraged information is restricted to the target method itself; and (2) lack of distinctions towards the contributions of tokens extracted from different program contexts.
Through a large-scale empirical analysis on +12M methods from +14K real-world projects, we found that (1) the tokens composing a method's name can be frequently observed in its callers/callees; and (2) tokens extracted from different specific contexts have diverse probabilities to compose the target method's name.
Motivated by our findings, we propose, in this paper, a context-guided method name recommender, which mainly embodies two key ideas:
(1) apart from the {\em local context}, which is extracted from the target method itself, we also consider the {\em global context}, which is extracted from other methods in the project that have call relations with the target method, to include more useful information; and (2) we utilize our empirical results as the {\em prior knowledge} to guide the generation of method names and also to restrict the number of tokens extracted from the global contexts.
We implemented the idea as {\bf Cognac} and performed extensive experiments to assess its effectiveness. Results reveal that \toolname can (1) perform better than existing approaches on the \textit{method name recommendation} task (e.g., it achieves an F-score of 63.2%, 60.8%, 66.3%, and 68.5%, respectively, on four widely-used datasets, which all outperform existing techniques);
and (2) achieve higher performance than existing techniques on the \textit{method name consistency checking} task (e.g., its overall $accuracy$ reaches 76.6%, outperforming the state-of-the-art MNire by 11.2%).
Further results reveal that the caller/callee information and the prior knowledge all contribute significantly to the overall performance of {\bf Cognac}.
Thu 26 AugDisplayed time zone: Athens change
11:00 - 12:00 | Analytics & Software Evolution—Program ComprehensionResearch Papers +12h Chair(s): Santanu Dash University of Surrey, Anthony Cleve University of Namur | ||
11:00 10mPaper | Lightweight Global and Local Contexts Guided Method Name Recommendation with Prior Knowledge Research Papers Shangwen Wang National University of Defense Technology, Ming Wen Huazhong University of Science and Technology, Bo Lin National University of Defense Technology, Xiaoguang Mao National University of Defense Technology DOI Pre-print | ||
11:10 10mPaper | To Read or to Rotate? Comparing the Effects of Technical Reading Training and Spatial Skills Training on Novice Programming Ability Research Papers Madeline Endres University of Michigan, Madison Fansher University of Michigan, Priti Shah University of Michigan, Westley Weimer University of Michigan DOI Pre-print | ||
11:20 10mPaper | Connecting the Dots: Rethinking the Relationship between Code and Prose Writing with Functional Connectivity Research Papers Zachary Karas University of Michigan, Andrew Jahn University of Michigan, Westley Weimer University of Michigan, Yu Huang University of Michigan DOI | ||
11:30 30mLive Q&A | Q&A (Analytics & Software Evolution—Program Comprehension) Research Papers |
23:00 - 00:00 | Analytics & Software Evolution—Program ComprehensionResearch Papers Chair(s): Venera Arnaoudova Washington State University, Bonita Sharif University of Nebraska-Lincoln, USA | ||
23:00 10mPaper | Lightweight Global and Local Contexts Guided Method Name Recommendation with Prior Knowledge Research Papers Shangwen Wang National University of Defense Technology, Ming Wen Huazhong University of Science and Technology, Bo Lin National University of Defense Technology, Xiaoguang Mao National University of Defense Technology DOI Pre-print | ||
23:10 10mPaper | To Read or to Rotate? Comparing the Effects of Technical Reading Training and Spatial Skills Training on Novice Programming Ability Research Papers Madeline Endres University of Michigan, Madison Fansher University of Michigan, Priti Shah University of Michigan, Westley Weimer University of Michigan DOI Pre-print | ||
23:20 10mPaper | Connecting the Dots: Rethinking the Relationship between Code and Prose Writing with Functional Connectivity Research Papers Zachary Karas University of Michigan, Andrew Jahn University of Michigan, Westley Weimer University of Michigan, Yu Huang University of Michigan DOI | ||
23:30 30mLive Q&A | Q&A (Analytics & Software Evolution—Program Comprehension) Research Papers |