CSC/ECE 517 Fall 2012/ch2b 2w52 sj

From Expertiza_Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Iterator Pattern

Iterator pattern provides a uniform way to access different collection of items without exposing any of its underlying representation. The following list of references provides information about the Iterator pattern - its implementation, UML diagrams and executable code in different languages. There are some very good videos about Iterator pattern, which are listed at the end of this article.

http://www.oodesign.com/iterator-pattern.html

This link provides the definition of and introduction to Iterator Pattern. With the help of a class diagram, the link explains the ability to create a general purpose GUI component that can be used to iterate through any collection of an application. An example of an iterator used to iterate over a collection of books is provided. Specific problems and implementation details are provided in this link. This covers: Information about Internal, External and Robust Iterators. Difference between an iterator and a cursor. Issues with using iterators in multithreading is discussed.

http://en.wikipedia.org/wiki/Iterator_pattern

This link gives the gist of Iterator pattern. It gives language specific implementation details for the same using C++, Java and Python. It also provides references to other links related to same topic.

http://www.dofactory.com/Patterns/PatternIterator.aspx#_self2

This link discusses the real world example of an Iterator pattern with an executable C# code. Code level details are explained with the assistance of UML class diagram Participants of an iterator pattern are clearly described.

http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf

This is a paper titled “The Essence of Iterator Pattern”, under consideration for the publication of Journal of Functional Programming. Authors: Jeremy Gibbons and Bruno C. d. S. Oliveira Abstract: The Iterator pattern gives a clean interface for element-by-element access to a collection, independent of the collection’s shape. But the paper argues that existing functional models of iteration capture one or other of these aspects, but not both simultaneously. The paper further states that McBride and Paterson’s applicative functors, and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the Iterator pattern in a way that nicely supports modular programming. The paper presents some axioms for traversal, discuss modularity concerns, and illustrate with a simple example, the wordcount problem.

http://userpages.umbc.edu/~tarr/dp/lectures/Iterator-2pp.pdf

This is a detailed presentation on Iterator pattern. The presentation discusses about basics of Iterator pattern with a simple examples of List aggregate with Iterator and Polymorphic aggregator along with client code. It also includes structure of the Iterator pattern, participants of the Iterator pattern, It highlights the benefits of using Iterators. Implementation issues and related design patterns are covered. The presentation continues with the Java implementation of the Iterator pattern with an example of Enumeration interface, Vector enumeration, The Java Collection Framework Interfaces like - The Collection Interface, The Iterator Interface, The ListIterator Interface and detailed example of Linked list.

http://sourcemaking.com/design_patterns/iterator

This is a well organized article discussing all aspects of Iterator. The article specifies the intent of Iterator Pattern. It speaks about the Problem in hand - the need to “abstract” the traversal of wildly different data structures so that algorithms can be defined that are capable of interfacing with each transparently It substantiates with a detailed discussion of how the pattern solves the problem An example of Television set is mentioned for a better understanding. If the programme on one channel is not of interest, the viewer can request the next channel, without knowing its number. Finally a check list and basic rules of thumb for implementation are provided. The article provides additional links to Iterator code examples in C#, C++, Delphi, Java and PHP.

http://www.allapplabs.com/java_design_patterns/iterator_pattern.htm

This link on Java Design patterns describes Iterator Pattern as an example for Behavioral pattern. The article clearly explains the use of Iterator with an example from our day to day life – Remote Control and Channel Surfer. Consider the usecase of a remote control. We just pick up the TV remote control and start pressing Up and Down or Forward and Back keys to iterate through the channels. This example is used to describe the Iterator pattern. The implementation of the Iterator pattern for the Remote Control is well explained with a supporting Java code.

http://www.codeproject.com/Articles/11554/Iterator-Pattern

This link gives the GoF definition of Iterator Pattern. It provides the UML diagram for Iterator Pattern. Besides, it discusses the standard examples of Iterators in Market, which includes discussion on collection classes in VB.Net and C#. It describes when and where to use iterators in day to day programming. Finally a sample code for Iterator pattern is provided.

http://www.theperlreview.com/Articles/v0i5/iterators.pdf

1. This article talks about the Iterator pattern and how the language Perl provides some of the Iterator features already along with Author’s own implementation of some parts of the code. 2. The article includes types of Iterator pattern – Internal and External Iterators and explains the same with examples written in Perl. Iterator interfaces are explained which includes topics about Objects methods and custom controllers. 3. How closures can be used to create Iterators. 4. Finally, it lists a set of modules in Perl which represent Iterators.

http://www.blackwasp.co.uk/Iterator.aspx

The article starts with a how the iterator pattern is used to provide a standard interface for traversing a collection of items. It has a UML class diagram which describes a classic implementation of the iterator design pattern. Each of the items included in the diagram are explained in detail. The article also provides the basic code of the iterator design pattern implemented using C#.

http://wiki.tcl.tk/9053

This link talks in detail about the Iterator patten with an example which shows how to compose iterators to realise complex set operations, with an example code to intersects an iterator with a union iterator:

Links to videos

http://www.newthinktank.com/2012/10/iterator-design-pattern-tutorial/

This is a very good presentation about Iteration design pattern which includes a video and also the code explained in the video. The video begins with basic introduction to the Iterator design pattern and proceeds with an example on how to traverse through a collection of Songs using Iterator pattern.

http://www.youtube.com/watch?v=Ns_BPBnPHIU

This video demonstrates how to use the Iterator pattern with examples It provides a UML class diagram explaining how Iterator interface is implemented.

http://www.youtube.com/watch?v=uY8n7hIivMU

This video demonstrates how to use the Iterator pattern with examples and UML diagrams.