Skip to main content

The Use of Overloading in Java Programs

  • Conference paper
ECOOP 2010 – Object-Oriented Programming (ECOOP 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6183))

Included in the following conference series:

Abstract

Method overloading is a controversial language feature, especially in the context of Object Oriented languages, where its interaction with overriding may lead to confusing semantics. One of the main arguments against overloading is that it can be abused by assigning the same identity to conceptually different methods.

This paper describes a study of the actual use of overloading in Java. To this end, we developed a taxonomy of classification of the use of overloading, and applied it to a large Java corpus comprising more than 100,000 user defined types.

We found that more than 14% of the methods in the corpus are overloaded. Using sampling and evaluation by human raters we found that about 60% of overloaded methods follow one of the “non ad hoc use of overloading patterns” and that additional 20% can be easily rewritten in this form. The most common pattern is the use of overloading as an emulation of default arguments, a mechanism which does not exist in Java.

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 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.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. Arnold, K., Gosling, J.: The Java Programming Language. Addison-Wesley, Reading (1996)

    MATH  Google Scholar 

  2. Barker, R., Tempero, E.D.: A large-scale empirical comparison of object-oriented cohesion metrics. In: APSEC

    Google Scholar 

  3. Baxter, G., Frean, M., Noble, J., Rickerby, M., Smith, H., Visser, M., Melton, H., Tempero, E.: Understanding the shape of java software. SIGPLAN Not. 41(10), 397–412 (2006)

    Article  Google Scholar 

  4. Beugnard, A., Sadou, S.: Method overloading and overriding cause distribution transparency and encapsulation flaws. Journal of Object Technology 6(2), 31–46 (2007)

    Google Scholar 

  5. Cardelli, L., Wegner, P.: On understanding types, data abstractions, and polymorphism. ACM Comput. Surv. 17(4), 471–522 (1985)

    Article  Google Scholar 

  6. Cohen, J.: A coefficient of agreement for nominal scales. Educational and Psychological Measurement 20 (1960)

    Google Scholar 

  7. Cohen, T., Gil, J.: Self-calibration of metrics of Java methods. In: Proc. of the 37th Int. Conf. on Technology of OO Lang. and Sys. (TOOLS 2000 Pacific) (2000)

    Google Scholar 

  8. Cohen, T., Gil, J.Y., Maman, I.: JTL—the Java tools language. In: Tarr, P.L., Cook, W.R. (eds.) Proc. of the 21st Ann. Conf. on OO Prog. Sys., Lang. & Appl (OOPSLA 2006) (2006)

    Google Scholar 

  9. Cronbach, L.: Coefficient alpha and the internal structure of tests. Psychometrika 16(3), 297–334 (1951)

    Article  Google Scholar 

  10. Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.M.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)

    Google Scholar 

  11. Gil, J., Maman, I.: Micro patterns in Java code. In: Johnson, R., Gabriel, R.P. (eds.) Proc. of the 20th Ann. Conf. on OO Prog. Sys., Lang. & Appl. (OOPSLA 2005) (2005)

    Google Scholar 

  12. Gosling, J., Joy, B., Steele, G.L.J., Bracha, G.: The Java Language Specification, 3rd edn. Addison-Wesley, Reading (June 2005)

    Google Scholar 

  13. Hejlsberg, A., Wiltamuth, S., Golde, P.: The C# Programming Language, 2nd edn. Addison-Wesley, Reading (October 2003)

    Google Scholar 

  14. ISE. ISE EIFFEL The Language Reference. ISE, Santa Barbara, CA (1997)

    Google Scholar 

  15. Kernighan, B.W., Ritchie, D.M.: The C Programming Language, 2nd edn. Prentice-Hall, Englewood Cliffs (1988)

    Google Scholar 

  16. MacLennan, R.N.: Interrater reliability with spss for windows 5.0. The American Statistician 47(4), 292–296 (1993)

    Article  Google Scholar 

  17. Melton, H., Tempero, E.: Static members and cycles in java software. In: ESEM

    Google Scholar 

  18. Meyer, B.: Overloading vs. object technology. Journal of Object-Oriented Programming, 3–7 (2001)

    Google Scholar 

  19. Nunnally, J., Bernstein, I.: Psychometric theory (1978), rds.epi-ucsf.org

  20. Stroustrup, B.: The C++ Programming Language, 3rd edn. Addison-Wesley, Reading (1997)

    Google Scholar 

  21. Tempero, E., Noble, J., Melton, H.: How do java programs use inheritance? An empirical study of inheritance in java software. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 667–691. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  22. Wilson, E.B.: Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association 22(158), 209–212 (1927)

    Article  Google Scholar 

  23. Yang, H.Y., Tempero, E., Melton, H.: An empirical study into use of dependency injection in java. In: ASWEC 2008: Proceedings of the 19th Australian Conference on Software Engineering (2008)

    Google Scholar 

  24. Zipf, G.K.: The Psychobiology of Language. Houghton-Mifflin, New York (1935)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gil, J.(., Lenz, K. (2010). The Use of Overloading in Java Programs. In: D’Hondt, T. (eds) ECOOP 2010 – Object-Oriented Programming. ECOOP 2010. Lecture Notes in Computer Science, vol 6183. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14107-2_25

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-14107-2_25

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-14106-5

  • Online ISBN: 978-3-642-14107-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics