Modularity in the Presence of Subclassing

  • Authors:
  • R. Stata

  • Affiliations:
  • -

  • Venue:
  • Modularity in the Presence of Subclassing
  • Year:
  • 1997

Quantified Score

Hi-index 0.00

Visualization

Abstract

Classes are harder to subclass than they need be. This report addresses this problem, showing how to design classes that are more modular and easier to subclass without sacrificing the extensibility that makes subclassing useful. In the context of single inheritance, we argue that specialization interfaces should be partitioned into class components. A class component groups part of a class''s state together with methods to maintain that state. Class components establish abstraction boundaries within classes, allowing modular replacement by subclasses. Replaceability requires reasoning about each component as an independent unit that depends only on the specifications of other components and not on their implementations. We discuss rules for such reasoning. In the context of multiple inheritance, we advocate the use of mixins as a replacement for class components. Instantiable classes are built by combining multiple mixins. In the mixin style of design, class hierarchies have more classes than in equivalent single-inheritance designs, but the classes have smaller, simpler interfaces and can be reused more flexibly. To explore the impact our ideas might have on program design, we consider existing libraries in light of the proposed single- and multiple-inheritance methodologies. We also consider the impact of our ideas on language design.