Object-oriented encapsulation for dynamically typed languages

被引:8
|
作者
Schärli, N
Black, AP
Ducasse, S
机构
[1] Univ Bern, Software Composit Grp, Bern, Switzerland
[2] Oregon Hlth & Sci Univ, OGI Sch Sci & Engn, Portland, OR 97201 USA
关键词
dynamic typing; encapsulation; encapsulation policies; information hiding; smalltalk;
D O I
10.1145/1035292.1028988
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Encapsulation in object-oriented languages has traditionally been based on static type systems. As a consequence; dynamically-typed languages have only limited support for encapsulation. This is surprising, considering that encapsulation is one of the most fundamental and important concepts behind object-oriented programming and that it is essential for writing programs that are maintainable and reliable, and that remain robust as they evolve. In this paper we describe the problems that are caused by insufficient encapsulation mechanisms and then present object-oriented encapsulation, a simple and uniform approach that solves these problems by bringing state of the art encapsulation features to dynamically typed languages. We provide a detailed discussion of our design rationales and compare them and their consequences to the encapsulation approaches used for statically typed languages. We also describe an implementation of object-oriented encapsulation in Smalltalk. Benchmarks of this implementation show that extensive use of object-oriented encapsulation results in a slowdown of less than 15 percent.
引用
收藏
页码:130 / 149
页数:20
相关论文
共 50 条