What Programmers Do with Inheritance in Java

  • Ewan Tempero
  • Hong Yul Yang
  • James Noble
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7920)


Inheritance is a distinguishing feature of object-oriented programming languages, but its application in practice remains poorly understood. Programmers employ inheritance for a number of different purposes: to provide subtyping, to reuse code, to allow subclasses to customise superclasses’ behaviour, or just to categorise objects. We present an empirical study of 93 open-source Java software systems consisting over over 200,000 classes and interfaces, supplemented by longitudinal analyses of 43 versions of two systems. Our analysis finds inheritance is used for two main reasons: to support subtyping and to permit what we call external code reuse. This is the first empirical study to indicate what programmers do with inheritance.


Java Code Method Invocation Multiple Inheritance Subtype Relation Inheritance Relationship 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Basili, V.R., Briand, L.C., Melo, W.L.: A validation of object-oriented design metrics as quality indicators. IEEE Trans. Softw. Eng. 22(10), 751–761 (1996)CrossRefGoogle Scholar
  2. 2.
    Bloch, J.: Effective Java, 2nd edn. Addison-Wesley (2008)Google Scholar
  3. 3.
    Briand, L.C., Daly, J., Porter, V., Wüst, J.K.: A comprehensive empirical validation of design measures for object-oriented systems. In: METRICS 1998: Proceedings of the 5th International Symposium on Software Metrics, pp. 246–257. IEEE Computer Society, Washington, DC (1998)Google Scholar
  4. 4.
    Budd, T.: An Introduction to Object-Oriented Programming, 3rd edn. Addison-Wesley (2002)Google Scholar
  5. 5.
    Cargill, T.A.: The case against multiple inheritance in C++. USENIX Computing Systems 4(1), 69–82 (1991)Google Scholar
  6. 6.
    Cartwright, M.: An empirical view of inheritance. Information and Software Technology 40, 795–799 (1998)CrossRefGoogle Scholar
  7. 7.
    Chidamber, S.R., Kemerer, C.F.: A metrics suite for object oriented design. IEEE Trans. Softw. Eng. 20(6), 476–493 (1994)CrossRefGoogle Scholar
  8. 8.
    Chidamber, S.R., Kemerer, C.F.: Towards a metrics suite for object oriented design. In: OOPSLA, pp. 197–211 (1991)Google Scholar
  9. 9.
    Cook, W.R., Hill, W., Canning, P.S.: Inheritance is not subtyping. In: Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1990, pp. 125–135. ACM, New York (1990)CrossRefGoogle Scholar
  10. 10.
    Daly, J., Brooks, A., Miller, J., Roper, M., Wood, M.: Evaluating inheritance depth on the maintainability of object-oriented software. Empirical Software Engineering 1(2), 109–132 (1996)CrossRefGoogle Scholar
  11. 11.
    Fenton, N.E., Pfleeger, S.L.: Software Metrics: A Rigorous and Practical Approach. PWS Publishing Co., Boston (1998)Google Scholar
  12. 12.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns. Addison Wesley Publishing Company, Reading (1994)Google Scholar
  13. 13.
    Gil, J(Y.), Maman, I.: Micro patterns in Java code. In: OOPSLA, pp. 97–116 (2005)Google Scholar
  14. 14.
    Harrison, R., Counsell, S., Nithi, R.: Experimental assessment of the effect of inheritance on the maintainability of object-oriented systems. Journal of Systems and Software 52, 173–179 (2000)CrossRefGoogle Scholar
  15. 15.
    Holub, A.: Why extends is evil: Improve your code by replacing concrete base classes with interfaces (August 2003),
  16. 16.
    Johnson, R.E., Foote, B.: Designing reusable classes. Journal of Object-Oriented Programming (June/July 1988)Google Scholar
  17. 17.
    Liskov, B.: Keynote address — data abstraction and hierarchy. SIGPLAN Notices 23(5), 17–34 (1987)CrossRefGoogle Scholar
  18. 18.
    Manel, D., Havanas, W.: A study of the impact of C++ on software maintenance. In: International Conference on Software Maintenance, pp. 63–69 (1990)Google Scholar
  19. 19.
    Meyer, B.: Genericity versus inheritance. In: OOPSLA, pp. 391–405. ACM, New York (1986)Google Scholar
  20. 20.
    Meyer, B.: The many faces of inheritance: a taxonomy of taxonomy. IEEE Computer 29(5), 105–108 (1996)CrossRefGoogle Scholar
  21. 21.
    Pradel, M., Gross, T.R.: Automatic testing of sequential and concurrent substitutability. In: International Conference on Software Engineering, ICSE (2013)Google Scholar
  22. 22.
    Schmager, F., Cameron, N., Noble, J.: GoHotDraw: evaluating the go programming language with design patterns. In: Evaluation and Usability of Programming Languages and Tools, PLATEAU 2010, pp. 10:1–10:6. ACM, New York (2010)Google Scholar
  23. 23.
    Snyder, A.: Encapsulation and inheritance in object-oriented programming languages. In: OOPSLA, pp. 38–45 (1986)Google Scholar
  24. 24.
    Sumption, B.: Inheritance is evil, and must be destroyed (2007), (last accessed December 2012)
  25. 25.
    Taivalsaari, A.: On the notion of inheritance. Comp. Surv. 28(3), 438–479 (1996)CrossRefGoogle Scholar
  26. 26.
    Tempero, E., Anslow, C., Dietrich, J., Han, T., Li, J., Lumpe, M., Melton, H., Noble, J.: Qualitas corpus: A curated collection of Java code for empirical studies. In: 2010 Asia Pacific Software Engineering Conference (APSEC 2010), pp. 336–345 (December 2010),
  27. 27.
    Tempero, E., Counsell, S., Noble, J.: An empirical study of overriding in open source Java. In: Thirty-Third Australasian Computer Science Conference (ACSC 2010), Brisbane, Australia. The Conferences in Research and Practice in Information Technology (CRPIT) Series, vol. 102, pp. 3–12 (January 2010)Google Scholar
  28. 28.
    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)CrossRefGoogle Scholar
  29. 29.
    Vallée-Rai, R., Hendren, L., Sundaresan, V., Lam, P., Gagnon, E., Co, P.: Soot - a Java optimization framework. In: CASCON, pp. 125–135 (1999)Google Scholar
  30. 30.
    Waldo, J.: Controversy: The case for multiple inheritance in C++. USENIX Computing Systems 4(2), 157–172 (1991)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Ewan Tempero
    • 1
  • Hong Yul Yang
    • 1
  • James Noble
    • 2
  1. 1.University of AucklandAucklandNew Zealand
  2. 2.School of Engineering and Computer ScienceVictoria University of WellingtonWellingtonNew Zealand

Personalised recommendations