Iterators and Encapsulation

  • Authors:
  • James Noble

  • Affiliations:
  • -

  • Venue:
  • TOOLS '00 Proceedings of the Technology of Object-Oriented Languages and Systems (TOOLS 33)
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.