Dependency-Aware Method Naming Framework with Generative Adversarial Sampling
Authors:
- 30 June 2024
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 1-8
Abstract
Method naming plays a vital role in code readability and maintenance. Researchers have proposed various approaches to automate method name recommendation and consistency checking task. However, two issues still remain unsolved: 1) Current work mainly focuses on local implementation and class-enclosed contexts, while dependency information is not fully exploited for the method name recommendation (MNR) task. 2) As a binary classification task, the method name consistency checking (MCC) task lacks high-quality negative samples severely, posing a challenge to train model. In this paper, we propose DMNA, a method naming framework with dependencies and generative adversarial sampling, which could help alleviate the above-mentioned problems. First, we introduce dependency information with other method contexts into training, which helps improve the performance of MNR task. Second, we leverage the model tuned for MNR task to generate high-quality adversarial samples for MCC task. Finally, we utilize prompt tuning to align the downstream task objective with the pre-training task, which helps alleviate the discrepancy problem and exploit the potential of pre-trained models. We validate the effectiveness of our approach on five widely-adopted datasets. Experimental results show that DMNA scores 49.1%, 58.5%, 63.5%, 75.4% on exact match accuracy for four MNR datasets, outperforming the SoTA baseline by at least 6.2%. And DMNA improves the accuracy of MCC task from 80.8% to 81.8%.Keywords
Funding Information
- Research and Development
This publication has 19 references indexed in Scilit:
- Automating Method Naming with Context-Aware Prompt-Tuning2023
- Method Name Generation Based on Code Structure Guidance2022
- Keywords Guided Method Name Generation2021
- A Context-Based Automated Approach for Method Name Consistency Checking and Suggestion2021
- Mercem: Method Name Recommendation Based on Call Graph Embedding2019
- Learning to Spot and Refactor Inconsistent Method Names2019
- Automatic identifier inconsistency detection using code dictionaryEmpirical Software Engineering, 2015
- How often do unintended inconsistencies happen? Deriving modification patterns and detecting overlooked code fragments2012
- Debugging Method Names2009
- Concise and consistent namingSoftware Quality Journal, 2006