Modularity in the Presence of Subclassing Raymie Stata Publication History

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 sacriicing the extensibility that makes subclassing useful to begin with. We argue that a class should have t w o i n terfaces, an instance interface used by programmers manipulating instances of the class, and a specialization interface used by programmers building subclasses of the class. Instance interfaces are relatively well understood, but design principles for specialization interfaces are not. 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 of components by subclasses. Achieving this replaceability requires reasoning about each component as an independent unit that depends only on the speciications of other components and not on their implementations. We i n troduce the concept of abstract representation to denote the view of a class's state given in its specialization interface. This view is more detailed than the view used to describe instances of the class, revealing details that describe the interfaces between class components. It is less detailed than the actual implementation, hiding implementation details that should not be exposed even to specializers. We also consider multiple inheritance, speciically, S n yder's model of encapsulated multiple inheritance. We advocate separating class components into individual classes called mixins. Instantiable classes are built by combining multiple mixins. With the mixin style of design, class hierarchies have more classes than in equivalent single-inheritance designs. These classes have smaller, simpler interfaces and can be reused more exibly. To explore the impact our ideas might h a v e on program design, we consider classes from existing libraries in light of the proposed single-and multiple-inheritance methodologies. To explore the impact our ideas might h a v e on language design, we present t w o diierent extensions to Java, one that provides a level of static checking for single-inheritance designs, and another that adds the encapsulated model of multiple inheritance. Acknowledgements This report revises a PhD dissertation of the same title. My advisor, John Guttag, contributed to the thesis in innumerable ways. His own research on software engineering, and the courses he's developed and taught, were important, technical innuences. By turning my …

[1]  Andrew C. Myers,et al.  Subtypes vs. where clauses: constraining parametric polymorphism , 1995, OOPSLA.

[2]  Grady Booch,et al.  Object-Oriented Analysis and Design with Applications , 1990 .

[3]  Adele Goldberg,et al.  SmallTalk 80: The Language , 1989 .

[4]  Ted G. Lewis Object oriented application frameworks , 1995 .

[5]  Martín Abadi,et al.  Methods as Assertions , 1994, Theory Pract. Object Syst..

[6]  Mandayam K. Srivas,et al.  Computability and Implementability Issues in Abstract Data Types , 1988, Sci. Comput. Program..

[7]  Daniel G. Bobrow,et al.  Book review: The Art of the MetaObject Protocol By Gregor Kiczales, Jim des Rivieres, Daniel G. and Bobrow(MIT Press, 1991) , 1991, SGAR.

[8]  C. A. R. Hoare,et al.  Proof of correctness of data representations , 1972, Acta Informatica.

[9]  David L. Detlefs,et al.  An Overview of the Extended Static Checking System , 2007 .

[10]  John Lamping,et al.  Typing the specialization interface , 1993, OOPSLA '93.

[11]  David E. Evans,et al.  Static detection of dynamic memory errors , 1996, PLDI '96.

[12]  James A. Gosling,et al.  The Java application programming interface , 1996 .

[13]  Brian W. Kernighan and Dennis M. Ritchie,et al.  “The C Programming Language”, 2nd Edition, Pearson Education, 1988. , 2015 .

[14]  Patrick Steyaert,et al.  A Marriage of Class- and Object-Based inheritance Without Unwanted Children , 1995, ECOOP.

[15]  Jeannette M. Wing,et al.  A behavioral notion of subtyping , 1994, TOPL.

[16]  Todd Leavens Gary Verifying object-oriented programs that use subtypes , 1989 .

[17]  Roger S. Pressman,et al.  Software Engineering: A Practitioner's Approach , 1982 .

[18]  Philip Wadler Type systems for object-oriented programming , 1994 .

[19]  Pierre America,et al.  Designing an Object-Oriented Programming Language with Behavioural Subtyping , 1990, REX Workshop.

[20]  Stephen H. Edwards Representation inheritance: a safe form of "white box" code inheritance , 1996, Proceedings of Fourth IEEE International Conference on Software Reuse.

[21]  William R. Cook,et al.  Inheritance is not subtyping , 1989, POPL '90.

[22]  V. Stavridou,et al.  Abstraction and specification in program development , 1988 .

[23]  R. J. Pooley An Introduction to Programming in Simula , 1987 .

[24]  David A. Moon,et al.  The Lisp Machine manual , 1981, SGAR.

[25]  J. Michael Spivey,et al.  The Z notation - a reference manual , 1992, Prentice Hall International Series in Computer Science.

[26]  Harold Ossher,et al.  Subject-oriented programming: a critique of pure objects , 1993, OOPSLA '93.

[27]  Sonya E. Keene,et al.  Object-oriented programming in COMMON LISP - a programmer's guide to CLOS , 1989 .

[28]  William R. Cook,et al.  Mixin-based inheritance , 1990, OOPSLA/ECOOP '90.

[29]  David Notkin,et al.  Using C++ Templates to Implement Role-Based Designs , 1996, ISOTAS.

[30]  Erich Gamma,et al.  ET++—a portable, homogeneous class library and application framework , 1995 .

[31]  Urs Hölzle,et al.  Integrating Independently-Developed Components in Object-Oriented Languages , 1993, ECOOP.

[32]  John C. Mitchell,et al.  A Delegation-based Object Calculus with Subtying , 1995, FCT.

[33]  Stephen J. Garland,et al.  Larch: Languages and Tools for Formal Specification , 1993, Texts and Monographs in Computer Science.

[34]  Gary T. Leavens,et al.  Foundations of Object-Oriented Languages: 2nd Workshop report , 1995, SIGP.

[35]  Wilf R. LaLonde,et al.  Inside Smalltalk (Volume 1) , 1990 .

[36]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[37]  David R. Musser,et al.  STL tutorial and reference guide - C++ programming with the standard template library , 1996, Addison-Wesley professional computing series.