Composable Encapsulation Policies

Given the importance of encapsulation to object-oriented programming, it is surprising to note that mainstream object-oriented languages offer only limited and fixed ways of encapsulating methods. Typically one may only address two categories of clients, users and heirs, and one must bind visibility and access rights at an early stage. This can lead to inflexible and fragile code as well as clumsy workarounds. We propose a simple and general solution to this problem in which encapsulation policies can be specified separately from implementations. As such they become composable entities that can be reused by different classes. We present a detailed analysis of the problem with encapsulation and visibility mechanisms in mainstream OO languages, we introduce our approach in terms of a simple model, and we evaluate how our approach compares with existing approaches. We also assess the impact of incorporating encapsulation policies into Smalltalk.

[1]  Mira Mezini,et al.  Integrating independent components with on-demand remodularization , 2002, OOPSLA '02.

[2]  Kim Mens,et al.  Vrije Universiteit Brussel Faculteit Wetenschappen Reuse Contracts: Managing the Evolution of Reusable Assets Reuse Contracts: Managing the Evolution of Reusable Assets , 2022 .

[3]  Mario Wolczko Encapsulation, delegation and inheritance in object-oriented languages , 1992, Softw. Eng. J..

[4]  Ole Lehrmann Madsen,et al.  Object-oriented programming in the BETA programming language , 1993 .

[5]  Stéphane Ducasse,et al.  Adding Dynamic Interfaces to Smalltalk , 2002, J. Object Technol..

[6]  Gilad Bracha,et al.  The programming language jigsaw: mixins, modularity and multiple inheritance , 1992 .

[7]  Oscar Nierstrasz,et al.  Traits: Composable Units of Behaviour , 2002, ECOOP.

[8]  Emil Sekerinski,et al.  A Study of The Fragile Base Class Problem , 1998, ECOOP.

[9]  Alan Snyder Encapsulation and inheritance in object-oriented programming languages , 1986, OOPSLA 1986.

[10]  Oscar Nierstrasz,et al.  A Survey of Object-Oriented Concepts , 1989, Object-Oriented Concepts, Databases, and Applications.

[11]  Paul Reynolds,et al.  Automating delegation in class-based languages , 2000, Proceedings. 34th International Conference on Technology of Object-Oriented Languages and Systems - TOOLS 34.

[12]  John Maloney,et al.  Back to the Future The Story of Squeak, A Practical Smalltalk Written in Itself , 1997 .

[13]  S. Tucker Taft Ada 9X: from abstraction-oriented to object-oriented , 1993, OOPSLA '93.

[14]  Günter Kniesel Type-Safe Delegation for Run-Time Component Adaptation , 1999, ECOOP.

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

[16]  Antero Taivalsaari,et al.  On the notion of inheritance , 1996, CSUR.