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.
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
Arnold, K., Gosling, J.: The Java Programming Language. Addison-Wesley, Reading (1996)
Barker, R., Tempero, E.D.: A large-scale empirical comparison of object-oriented cohesion metrics. In: APSEC
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)
Beugnard, A., Sadou, S.: Method overloading and overriding cause distribution transparency and encapsulation flaws. Journal of Object Technology 6(2), 31–46 (2007)
Cardelli, L., Wegner, P.: On understanding types, data abstractions, and polymorphism. ACM Comput. Surv. 17(4), 471–522 (1985)
Cohen, J.: A coefficient of agreement for nominal scales. Educational and Psychological Measurement 20 (1960)
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)
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)
Cronbach, L.: Coefficient alpha and the internal structure of tests. Psychometrika 16(3), 297–334 (1951)
Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.M.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)
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)
Gosling, J., Joy, B., Steele, G.L.J., Bracha, G.: The Java Language Specification, 3rd edn. Addison-Wesley, Reading (June 2005)
Hejlsberg, A., Wiltamuth, S., Golde, P.: The C# Programming Language, 2nd edn. Addison-Wesley, Reading (October 2003)
ISE. ISE EIFFEL The Language Reference. ISE, Santa Barbara, CA (1997)
Kernighan, B.W., Ritchie, D.M.: The C Programming Language, 2nd edn. Prentice-Hall, Englewood Cliffs (1988)
MacLennan, R.N.: Interrater reliability with spss for windows 5.0. The American Statistician 47(4), 292–296 (1993)
Melton, H., Tempero, E.: Static members and cycles in java software. In: ESEM
Meyer, B.: Overloading vs. object technology. Journal of Object-Oriented Programming, 3–7 (2001)
Nunnally, J., Bernstein, I.: Psychometric theory (1978), rds.epi-ucsf.org
Stroustrup, B.: The C++ Programming Language, 3rd edn. Addison-Wesley, Reading (1997)
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)
Wilson, E.B.: Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association 22(158), 209–212 (1927)
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)
Zipf, G.K.: The Psychobiology of Language. Houghton-Mifflin, New York (1935)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)