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 PaperResearch

20 Citations (Scopus)


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 ’19 - Proceedings of the 2019 IEEE 26th International Conference on Software Analysis, Evolution, and Reengineering
Subtitle of host publicationFebruary 24-27, 2019 Hangzhou, China
EditorsXinyu Wang, David Lo, Emad Shihab
Place of PublicationPiscataway NJ USA
PublisherIEEE, Institute of Electrical and Electronics Engineers
Number of pages11
ISBN (Electronic)9781728105918
ISBN (Print)9781728105925
Publication statusPublished - 2019
EventIEEE International Conference on Software Analysis, Evolution, and Reengineering 2019 - Hangzhou, China
Duration: 24 Feb 201927 Feb 2019
Conference number: 26th
https://ieeexplore.ieee.org/xpl/conhome/8663526/proceeding (Proceedings)


ConferenceIEEE International Conference on Software Analysis, Evolution, and Reengineering 2019
Abbreviated titleSANER 2019
Internet address


  • Encoder-Decoder Model
  • Naming Convention
  • Transfer Learning

Cite this