JISE


  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]


Journal of Information Science and Engineering, Vol. 19 No. 5, pp. 839-856


Iterators: Taxonomy, Stength, Weakness, and Efficiency


Pei-Chi Wu and Feng-Jian Wang+
Department of Computer Science and Information Engineering 
National Penghu Institute of Technology 
Penghu, 880 Taiwan 
E-mail: pcwu@npit.edu.tw 
+Department of Computer Science and Information Engineering 
National Chiao Tung University 
Hsinchu, 300 Taiwan 
E-mail: fjwang@csie.nctu.edu.tw


    Iteration is an operation that traverses the objects of a collection object. Iterators are operators/methods widely used for iteration on a collection of objects. However, iterators were considered to be ad hoc and to be a sign of weakness in object-oriented programming languages. There is a need to formalize iterators and to study their strength and weaknesses. In this paper we first propose a taxonomy of iterators based on the number of data states and the number of control points. The taxonomy identifies four categories of iterators. The simplest one can be implemented straightforwardly in an object-oriented language. Iterators of other categories need transformations and are more difficult to design and implement. Finally, we compare the efficiency of iterators with other implementations of iteration. The results show that all iteration techniques tested, including iterators, have been well optimized and are almost as fast as directly coded loops using recent C++ compilers.


Keywords: collection objects, object-oriented programming, control points, efficiency, the C++ language

  Retrieve PDF document (JISE_200305_07.pdf)