teaching inheritance concepts with java
In teaching object-oriented programming, teaching inheritance is the most challenging and at the same time the most crucial aspect. The interplay of dynamic binding, late-bound self-reference, subtype polymorphism and method redefinition is so complex that it is difficult for instructors to design a gentle, step-by-step introduction. Should polymorphism be introduced first? Or is code reuse better suited as an introductory motivation? The Java Programming Language adds a further aspect to this discussion: when should named interfaces be introduced? Most textbooks follow the historical development of the mechanism and cover interfaces after the discussion of abstract classes. In this paper a different approach is described: interfaces are introduced long before and in isolation from inheritance; and the discussion of inheritance is explicitly split into its two major constituents, namely subtype polymorphism and implementation inheritance. We applied this novel approach in the two introductory courses on software development (SD1 and SD2) in the newly created Bachelor of Science in Informatics curriculum at the University of Hamburg, Germany. This experience report reflects on the design rationale behind this new approach.
pedagogy