Java interfaces in CS 1 textbooks

  • Authors:
  • Thomas VanDrunen

  • Affiliations:
  • Wheaton College, Wheaton, IL

  • Venue:
  • Companion to the 21st ACM SIGPLAN symposium on Object-oriented programming systems, languages, and applications
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

Java's interface construct allows for a clear distinction between subtype polymorphism based on a shared interface and code reuse based on class extension or inheritance. Design Patterns argues that in an object-oriented setting, programming should be done to an interface, not to an implementation, that class inheritance is a mechanism for code reuse rather than for subtyping and polymorphism, and that even composition should be favored over class inheritance. We conclude from this that interface should be introduced prior to and given more focus than classes and class inheritance. We survey 27 textbooks from major publishers to show that very few available texts teach Java this way. We propose an alternative ordering of material that will promote the principles mentioned above.