Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
American National Standards Institute, Inc. In: The Programming Language Ada. LNCS, vol. 155, Springer, Heidelberg (1983)
Bracha, G.: The Programming Language igsaw: Mixins, Modularity and Multiple Inheritance. Ph.D. thesis, Dept. of Computer Science, University of Utah (March 1992)
Freeman, S.: Partial revelation and Modula-3. Dr. Dobb’s Journal 20(10), 36–42 (1995)
Ingalls, D., Kaehler, T., Maloney, J., Wallace, S., Kay, A.: Back to the future: The story of Squeak, A practical Smalltalk written in itself. In: Proceedings OOPSLA 1997, November 1997, pp. 318–326. ACM Press, New York (1997)
Kniesel, G.: Type-safe delegation for run-time component adaptation. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 351–366. Springer, Heidelberg (1999)
Lamping, J.: Typing the specialization interface. In: Proceedings OOPSLA 1993, October 1993. ACM SIGPLAN Notices, vol. 28, pp. 201–214 (1993)
Madsen, O.L., Moller-Pedersen, B., Nygaard, K.: Object- Oriented Programming in the Beta Programming Language. Addison Wesley, Reading (1993)
Mezini, M., Ostermann, K.: Integrating independent components with ondemand remodularization. In: Proceedings OOPSLA 2002, November 2002, pp. 52–67 (2002)
Mikhajlov, L., Sekerinski, E.: A study of the fragile base class problem. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 355–383. Springer, Heidelberg (1998)
The Microsoft Developer Network, http://msdn.microsoft.com/
Nierstrasz, O.: A survey of object-oriented concepts. In: Kim, W., Lochovsky, F. (eds.) Object-Oriented Concepts, Databases and Applications, pp. 3–21. ACM Press and Addison Wesley, Reading, Mass (1989)
Sadeh, B., Ducasse, S.: Adding dynamic interface to Smalltalk. Journal of Object Technology 1(1) (2002)
Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.: Traits: Composable units of behavior. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003)
Snyder, A.: Encapsulation and inheritance in object-oriented programming languages. In: Proceedings OOPSLA ’86, November 1986. ACM SIGPLAN Notices, vol. 21, pp. 38–45 (1986)
Steyaert, P., Lucas, C., Mens, K., D’Hondt, T.: Reuse contracts: Managing the evolution of reusable assets. In: Proceedings of OOPSLA 1996 Conference, pp. 268–285. ACM Press, New York (1996)
Tucker Taft, S.: Ada 9x: From abstraction-oriented to object-oriented. In: Proceedings OOPSLA 1993, October 1993, vol. 28, pp. 127–143 (1993)
Taivalsaari, A.: On the notion of inheritance. ACM Computing Surveys 28(3), 438–479 (1996)
Viega, J., Reynolds, P., Behrends, R.: Automating delegation in classbased languages. In: Proceedings of TOOLS 34’00, July 2000, pp. 171–182 (2000)
Wolczko, M.: Encapsulation, delegation and inheritance in object-oriented languages. IEEE Software Engineering Journal 7(2), 95–102 (1992)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Schärli, N., Ducasse, S., Nierstrasz, O., Wuyts, R. (2004). Composable Encapsulation Policies. In: Odersky, M. (eds) ECOOP 2004 – Object-Oriented Programming. ECOOP 2004. Lecture Notes in Computer Science, vol 3086. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24851-4_2
Download citation
DOI: https://doi.org/10.1007/978-3-540-24851-4_2
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-22159-3
Online ISBN: 978-3-540-24851-4
eBook Packages: Springer Book Archive