par Schärli, Nathanael;Ducasse, Stéphane;Nierstrasz, Oscar;Wuyts, Roel
Référence Lecture notes in computer science, 3086, page (26-50)
Publication Publié, 2004
Article révisé par les pairs
Résumé : iven 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. copy; Springer-Verlag : 2004.