Comp Sci Notes - 10-8-07 - Adam Caplan Comp Sci Notes...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Adam Caplan 10/8/07 Comp Sci Notes Iterators o Key idea: Encapsulation and Abstraction Encapsulated state hidden inside an object, methods used to manipulate state o “Exposing the representation (rep)” is a big NO NO! Means you let user of the object see how you’re storing the data Why? User may be able to modify the state in unpredictable ways Ties the hands of the developer—keeping it hidden lets you change it later Loss of abstraction o Abstract data types for managing collections of objects Set, list, map – interfaces (ADTs) Sometimes design objectives compete Abstraction vs. Efficiency o High level languages o Exposing the representation Problem: Iterating over collections Want: A loop that will “visit” each item in a collection Maintain abstraction Efficient implementation Possibilities: o 1.) Let the user of the collection keep a reference to the current position in the set “Bookmark” Efficient but exposes the internal rep
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/10/2008 for the course CSE 131 taught by Professor Goldman during the Fall '07 term at Washington University in St. Louis.

Page1 / 3

Comp Sci Notes - 10-8-07 - Adam Caplan Comp Sci Notes...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online