This Article 
 Bibliographic References 
 Add to: 
Design and Specification of Iterators Using the Swapping Paradigm
August 1994 (vol. 20 no. 8)
pp. 631-643

How should iterators be abstracted and encapsulated in modern imperative languages? We consider the combined impact of several factors on this question: the need for a common interface model for user defined iterator abstractions, the importance of formal methods in specifying such a model, and problems involved in modular correctness proofs of iterator implementations and clients. A series of iterator designs illustrates the advantages of the swapping paradigm over the traditional copying paradigm. Specifically, swapping based designs admit more efficient implementations while offering relatively straightforward formal specifications and the potential for modular reasoning about program behavior. The final proposed design schema is a common interface model for an iterator for any generic collection.

[1] J. M. Bishop, "The effect of data abstraction on loop programming techniques,"IEEE Trans. Software Eng., vol. 16, pp. 389-402, Apr. 1990.
[2] G. Booch,Software Components with Ada. Menlo Park, CA: Benjamin/Prentice-Hall, 1987.
[3] R. D. Cameron, "Efficient high-level iteration with accumulators,"ACM TOPLAS, vol. 11, pp. 194-211, Apr. 1989.
[4] S. H. Edwards, "An approach for constructing reusable software components in Ada," Tech. Rep. P-2378, Inst. for Defense Analyses, Alexandria, VA, USA, 1990.
[5] S. H. Edwards, "Common interface models for components are necessary to support composability,"Proc. 4th Ann. Workshop on Software Reuse, SPC, Herndon, VA, USA, 1991.
[6] S. H. Edwards, "Common interface models for reusable software,"Int. J. Software Eng. Knowledge Eng., vol. 3, pp. 193-206, June 1993.
[7] S. H. Edwards, "A formal model of software subsystems," Ph.D. dissertation, Dept. of Comput. and Inform. Sci., Ohio State Univ., Columbus, OH, USA, in preparation.
[8] G. W. Ernst, R. J. Hookway, and W. F. Ogden, "Modular verification of data abstractions with shared representations,"IEEE Trans. Software Eng., vol. 20, pp. 288-307, Apr. 1994.
[9] D. E. Harms and B. W. Weide, "Copying and swapping: Influences on the design of reusable software components,"IEEE Trans. Software Eng.vol. 17, pp. 424-435, May 1991.
[10] J. E. Hoilingsworth, "Software Component Design for reuse: A language-independent discipline applied to Ada," Ph.D. thesis, Ohio State Univ., 1992.
[11] W. R. LaLonde, "Designing families of data types using exemplars,"ACM Trans. Programming Languages Syst., vol. 11, pp. 212-248, 1989.
[12] D. A. Lamb, "Specification of iterators,"IEEE Trans. Software Eng., vol. 16, pp. 1352-1360, Dec. 1990.
[13] B. Liskovet al., "Abstraction mechanisms in CLU,"Commun. ACM, vol. 20, pp. 564-576, Aug. 1977.
[14] S. Muralidharan and B. W. Weide, "Should data abstraction be violated to enhance software reuse?"Proc. 8th Ann. Natl. Conf. Ada Technol., 1990, pp. 515-524.
[15] T. W. Pearce and D. A. Lamb, "The property vector specification of a multiset iterator,"Proc. 14th Int. ACM/IEEE Conf. Software Eng., 1992.
[16] M. Shaw, W. A. Wulf, and L. London, "Abstraction and verification in Alphard: Defining and specifying iteration and generators."Commun. ACM, vol. 20, pp. 553-564, Aug. 1977.
[17] M. Sitaraman, L. R. Welch, and D. E. Harms, "On specification of reusable software components,"Int. J. Software Eng. Knowledge Eng., vol. 3, pp. 207-229, June 1993.
[18] W. Tracz, "Parameterization: A case study,"Ada Lett., vol. 9, pp. 92-102, May/June 1989.
[19] B. W. Weide, W.F. Ogden, and S.H. Zweben, "Reusable software components," inAdvances in Computers, vol. 33, M.C. Yovits, Ed. New York: Academic, 1991, to be published.
[20] J. M. Wing, "A specifier's introduction to formal methods,"Comput., vol. 23, pp. 8-24, Sept. 1990.

Index Terms:
formal specification; program verification; data encapsulation; iterators; swapping paradigm; imperative languages; common interface model; user defined iterator abstractions; formal methods; modular correctness proofs; iterator designs; formal specification; modular reasoning; program verification; proof of correctness; swapping
B.W. Weide, S.H. Edwards, D.E. Harms, D.A. Lamb, "Design and Specification of Iterators Using the Swapping Paradigm," IEEE Transactions on Software Engineering, vol. 20, no. 8, pp. 631-643, Aug. 1994, doi:10.1109/32.310672
Usage of this product signifies your acceptance of the Terms of Use.