Machine learning based recommendation of method names: How far are we

Lin Jiang, Hui Liu*, He Jiang

*此作品的通讯作者

科研成果: 书/报告/会议事项章节会议稿件同行评审

47 引用 (Scopus)

摘要

High quality method names are critical for the readability and maintainability of programs. However, constructing concise and consistent method names is often challenging, especially for inexperienced developers. To this end, advanced machine learning techniques have been recently leveraged to recommend method names automatically for given method bodies/implementation. Recent large-scale evaluations also suggest that such approaches are accurate. However, little is known about where and why such approaches work or don't work. To figure out the state of the art as well as the rationale for the success/failure, in this paper we conduct an empirical study on the state-of-the-art approach code2vec. We assess code2vec on a new dataset with more realistic settings. Our evaluation results suggest that although switching to new dataset does not significantly influence the performance, more realistic settings do significantly reduce the performance of code2vec. Further analysis on the successfully recommended method names also reveals the following findings: 1) around half (48.3%) of the accepted recommendations are made on getter/setter methods; 2) a large portion (19.2%) of the successfully recommended method names could be copied from the given bodies. To further validate its usefulness, we ask developers to manually score the difficulty in naming methods they developed. Code2vec is then applied to such manually scored methods to evaluate how often it works in need. Our evaluation results suggest that code2vec rarely works when it is really needed. Finally, to intuitively reveal the state of the art and to investigate the possibility of designing simple and straightforward alternative approaches, we propose a heuristics based approach to recommending method names. Evaluation results on large-scale dataset suggest that this simple heuristics-based approach significantly outperforms the state-of-the-art machine learning based approach, improving precision and recall by 65.25% and 22.45%, respectively. The comparison suggests that machine learning based recommendation of method names may still have a long way to go.

源语言英语
主期刊名Proceedings - 2019 34th IEEE/ACM International Conference on Automated Software Engineering, ASE 2019
出版商Institute of Electrical and Electronics Engineers Inc.
602-614
页数13
ISBN(电子版)9781728125084
DOI
出版状态已出版 - 11月 2019
活动34th IEEE/ACM International Conference on Automated Software Engineering, ASE 2019 - San Diego, 美国
期限: 10 11月 201915 11月 2019

出版系列

姓名Proceedings - 2019 34th IEEE/ACM International Conference on Automated Software Engineering, ASE 2019

会议

会议34th IEEE/ACM International Conference on Automated Software Engineering, ASE 2019
国家/地区美国
San Diego
时期10/11/1915/11/19

指纹

探究 'Machine learning based recommendation of method names: How far are we' 的科研主题。它们共同构成独一无二的指纹。

引用此