Skip to main content

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

  • Conference paper
Advanced Data Mining and Applications (ADMA 2012)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 7713))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Burges, C.J.C.: A tutorial on support vector machines for pattern recognition. Data Mining and Knowledge Discovery 2, 121–167 (1998)

    Article  Google Scholar 

  3. Chang, C., Lin, C.: LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology 2, 27:1–27:27 (2011)

    Google Scholar 

  4. 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)

    Chapter  Google Scholar 

  5. 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)

    Chapter  Google Scholar 

  6. Gosling, J., Joy, B., Steele, G., Bracha, G.: Java(TM) Language Specification, 3rd edn. Java Addison-Wesley. Addison-Wesley Professional (2005)

    Google Scholar 

  7. 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)

    Chapter  Google Scholar 

  8. 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)

    Chapter  Google Scholar 

  9. 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)

    Chapter  Google Scholar 

  10. Lawrie, D., Binkley, D.: Expanding identifiers to normalize source code vocabulary. In: ICSM, pp. 113–122. IEEE (2011)

    Google Scholar 

  11. Martin, R.C.: Clean Code: A handbook of agile software craftsmanship. Prentice Hall (2009)

    Google Scholar 

  12. Nedjah, N., de Macedo Mourelle, L., Kacprzyk, J., Frana, F.M.G., de Souza, A.F.: Intelligent Text Categorization and Clustering. Springer (2008)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics