Iterators and encapsulation

Iterators are an important object oriented design pattern, providing sequential access to the state stored in other objects. Precisely because iterators need to access the state of other objects, iterators' design can be at odds with the encapsulation provided by object oriented languages. We present a range of designs for iterator objects, showing how different designs have different encapsulation properties. Studying a range of different iterators can help programmers to identify the strengths and weaknesses of particular designs, and also illustrates some of the issues in the design of encapsulation mechanisms in programming languages.

[1]  Jan Vitek,et al.  Flexible Alias Protection , 1998, ECOOP.

[2]  James Noble Arguments and Results , 2000, Comput. J..

[3]  Olivier Zendra,et al.  Adding external iterators to an existing Eiffel class library , 1999, Proceedings Technology of Object-Oriented Languages and Systems. TOOLS 32.

[4]  Jan Vitek,et al.  Confined types , 1999, OOPSLA '99.

[5]  James Noble,et al.  Object ownership for dynamic alias protection , 1999, Proceedings Technology of Object-Oriented Languages and Systems. TOOLS 32.

[6]  O. J. Dahl,et al.  Simula Begin , 1979 .

[7]  John Hogg Islands: aliasing protection in object-oriented languages , 1991, OOPSLA 1991.

[8]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[9]  Stuart Kent,et al.  Encapsulation and Aggregation , 1995 .