1 / 8

Iterator Pattern

Iterator Pattern. By: Jonathan Ly MPCS 51410. Intent of the Iterator. Put the responsibility for access and transversal from the aggregate object and into the Iterator object. Creates a standard traversal protocol using the Iterator object. Iterator Significance.

hermanp
Download Presentation

Iterator Pattern

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Iterator Pattern By: Jonathan Ly MPCS 51410

  2. Intent of the Iterator • Put the responsibility for access and transversal from the aggregate object and into the Iterator object. • Creates a standard traversal protocol using the Iterator object.

  3. Iterator Significance • Iterator pattern falls under behavioral pattern category. • Ability to access an aggregated element without exposing its internal structure. • Ability to transverse a list in different ways, without bloating the list interface with operations for different transversal. • Provides a uniform interface for transversal for many types of aggregated objects.

  4. UML Implementation

  5. Applicability and Advantages • Provides a way of to access the elements of a collection object in a sequential manner. • Iterators can work without knowing the underlying representation of the collection object. • Ultimately, it separates the notion of algorithm and data structures, which helps promote component-based development, boost productivity, and reduce configuration management

  6. Iterator Example: Person’s Favorite Book

  7. Implementation of Example

  8. References • https://en.wikipedia.org/wiki/Iterator_pattern • https://www.tutorialspoint.com/design_pattern/iterator_pattern.htm • https://sourcemaking.com/design_patterns/iterato

More Related