THE EFFECT OF DATA ABSTRACTION ON LOOP PROGRAMMING TECHNIQUES

被引:13
作者
BISHOP, JM
机构
[1] Department of Electronics and Computer Science, University of Southampton
关键词
Abstract data types; Ada; control structure; data abstraction; generators; generic instantiation; iterators; loops;
D O I
10.1109/32.54291
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
There are several classic loop algorithms such as search-update, apply-to-all, find-the-first, all of which have many solutions. Some solutions use deft programming techniques, others rely on particular language control structures. Yet most solutions which appear in the literature are phrased in terms of arrays of integers and ignore the possibility of having other data types for either elements or indices, or of applying the solution to structures other than arrays. Data abstraction, as embodied in post-Pascal languages, encourages the definition of reusable components, and these loop algorithms are prime cases for packaging. This paper shows how the algorithms can be encompassed in an iterator and then activated for any data type for which a generator can be defined. It takes the iterator-generator idea a step further than previous work in that it permits variations of the iterators to be defined dynamically through the use of selectors and actors, without loss of efficiency or clarity. It is further shown that selectors can be employed in the definition of a truly generic sorting routine. Guidelines for the decomposition of a system into generic data types, abstract data types, iterators, generators, and the programs that exercise them are given, and several complete programs show the implementation of the techniques in Ada. © 1990 IEEE
引用
收藏
页码:389 / 402
页数:14
相关论文
共 22 条
[1]   A GENERALIZED ITERATIVE CONSTRUCT AND ITS SEMANTICS [J].
ANSON, E .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1987, 9 (04) :567-581
[2]   JUMPING ABOUT AND GETTING INTO A STATE [J].
ATKINSON, LV .
COMPUTER JOURNAL, 1984, 27 (01) :42-46
[3]  
BISHOP JM, 1986, DATA ABSTRACTION PRO, P92
[4]  
Booch G, 1987, SOFTWARE COMPONENTS
[5]  
DIJKSTRA EW, 1987, COMMUN ACM, V30, P661
[6]  
Dijkstra EW, 1976, DISCIPLINE PROGRAMMI
[7]  
ECKART JD, 1987, SIGPLAN NOTICES, V22, P103, DOI 10.1145/24714.24727
[8]   THE USE OF TERMINATION INDICATORS IN COMPUTER-PROGRAMMING [J].
ER, MC .
COMPUTER JOURNAL, 1986, 29 (05) :430-433
[9]  
KNUTH DE, 1974, ACM COMPUT SURV, V6, P251
[10]   ABSTRACTION MECHANISMS IN CLU [J].
LISKOV, B ;
SNYDER, A ;
ATKINSON, R ;
SCHAFFERT, C .
COMMUNICATIONS OF THE ACM, 1977, 20 (08) :564-576