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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Binkley, D., Hearn, M., Lawrie, D.: Improving identifier informativeness using part of speech information. In: Proc. of the Working Conf. on Mining Software Repositories (2011)
Burges, C.J.C.: A tutorial on support vector machines for pattern recognition. Data Mining and Knowledge Discovery 2, 121–167 (1998)
Chang, C., Lin, C.: LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology 2, 27:1–27:27 (2011)
Dallmeier, V., Lindig, C., Wasylkowski, A., Zeller, A.: Mining object behavior with adabu. In: Proceedings of the 2006 International Workshop on Dynamic Systems Analysis, WODA 2006, pp. 17–24. ACM, New York (2006)
Engler, D., Chen, D.Y., Hallem, S., Chou, A., Chelf, B.: Bugs as deviant behavior: a general approach to inferring errors in systems code. In: Proceedings of the Eighteenth ACM Symposium on Operating Systems Principles, SOSP 2001, pp. 57–72. ACM, New York (2001)
Gosling, J., Joy, B., Steele, G., Bracha, G.: Java(TM) Language Specification, 3rd edn. Java Addison-Wesley. Addison-Wesley Professional (2005)
Host, E.W., Ostvold, B.M.: The programmer’s lexicon, volume i: The verbs. In: Proceedings of the Seventh IEEE International Working Conference on Source Code Analysis and Manipulation, pp. 193–202. IEEE Computer Society, Washington, DC (2007)
Høst, E.W., Østvold, B.M.: Debugging Method Names. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 294–317. Springer, Heidelberg (2009)
Lawrie, D., Morrell, C., Feild, H., Binkley, D.: What’s in a name? a study of identifiers. In: Proceedings of the 14th IEEE International Conference on Program Comprehension, pp. 3–12. IEEE Computer Society, Washington, DC (2006)
Lawrie, D., Binkley, D.: Expanding identifiers to normalize source code vocabulary. In: ICSM, pp. 113–122. IEEE (2011)
Martin, R.C.: Clean Code: A handbook of agile software craftsmanship. Prentice Hall (2009)
Nedjah, N., de Macedo Mourelle, L., Kacprzyk, J., Frana, F.M.G., de Souza, A.F.: Intelligent Text Categorization and Clustering. Springer (2008)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Yu, S., Zhang, R., Guan, J. (2012). Properly and Automatically Naming Java Methods: A Machine Learning Based Approach. In: Zhou, S., Zhang, S., Karypis, G. (eds) Advanced Data Mining and Applications. ADMA 2012. Lecture Notes in Computer Science(), vol 7713. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35527-1_20
Download citation
DOI: https://doi.org/10.1007/978-3-642-35527-1_20
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-35526-4
Online ISBN: 978-3-642-35527-1
eBook Packages: Computer ScienceComputer Science (R0)