The Use of Overloading in Java Programs

12 years 3 months ago
The Use of Overloading in Java Programs
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.
Joseph Gil, Keren Lenz
Added 02 Sep 2010
Updated 02 Sep 2010
Type Conference
Year 2010
Authors Joseph Gil, Keren Lenz
Comments (0)