A Neural Model for Method Name Generation from Functional Description

Sa Gao, Chunyang Chen, Zhenchang Xing, Yukun Ma, Wen Song, Shang Wei Lin

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

35 Scopus citations

Abstract

The names of software artifacts, e.g., method names, are important for software understanding and maintenance, as good names can help developers easily understand others' code. However, the existing naming guidelines are difficult for developers, especially novices, to come up with meaningful, concise and compact names for the variables, methods, classes and files. With the popularity of open source, an enormous amount of project source code can be accessed, and the exhaustiveness and instability of manually naming methods could now be relieved by automatically learning a naming model from a large code repository. Nevertheless, building a comprehensive naming system is still challenging, due to the gap between natural language functional descriptions and method names. Specifically, there are three challenges: how to model the relationship between the functional descriptions and formal method names, how to handle the explosion of vocabulary when dealing with large repositories, and how to leverage the knowledge learned from large repositories to a specific project. To answer these questions, we propose a neural network to directly generate readable method names from natural language description. The proposed method is built upon the encoder-decoder framework with the attention and copying mechanisms. Our experiments show that our method can generate meaningful and accurate method names and achieve significant improvement over the state-of-The-Art baseline models. We also address the cold-start problem using a training trick to utilize big data in Github for specific projects.

Original languageEnglish
Title of host publicationSANER 2019 - Proceedings of the 2019 IEEE 26th International Conference on Software Analysis, Evolution, and Reengineering
EditorsEmad Shihab, David Lo, Xinyu Wang
PublisherInstitute of Electrical and Electronics Engineers Inc.
Pages411-421
Number of pages11
ISBN (Electronic)9781728105918
DOIs
StatePublished - 15 Mar 2019
Externally publishedYes
Event26th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2019 - Hangzhou, China
Duration: 24 Feb 201927 Feb 2019

Publication series

NameSANER 2019 - Proceedings of the 2019 IEEE 26th International Conference on Software Analysis, Evolution, and Reengineering

Conference

Conference26th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2019
Country/TerritoryChina
CityHangzhou
Period24/02/1927/02/19

Keywords

  • Encoder-Decoder Model
  • Naming Convention
  • Transfer Learning

Fingerprint

Dive into the research topics of 'A Neural Model for Method Name Generation from Functional Description'. Together they form a unique fingerprint.

Cite this