Properly and Automatically Naming Java Methods: A Machine Learning Based Approach

Shusi Yu,Ruichang Zhang,Jihong Guan
DOI: https://doi.org/10.1007/978-3-642-35527-1_20
2012-01-01
Abstract:Method names play an important role in software maintenance. A good name explains the function of a method to developers, while bad names mislead them. However, method naming is a complicated task. For example, Java programming specification suggests that method names should be verbs or verb phrases. Previous research shows that each identical verb is related to at least one name rule and each rule is consists of 30 conditions. Since large-scale software contains hundreds of identical verbs, choosing the proper verb for a method is related to thousands of conditions. There exists some semi-automated method verb rule mining techniques. these rules are useful to find if a method uses the wrong verb. However, they are not effective for general case when no rules are applicable. In addition, none of them discusses how to find the proper target of the verb. This paper proposes an automated method-naming tool, based on machine learning approach. Experiments on Eclipse and other Java projects show that our tool can successfully predict the verbs of 70% methods and pick out the proper targets in method contents for 90% methods.
What problem does this paper attempt to address?