Structured Programming with go to Statements by Knuth

Structured Programming with go to Statements by Knuth - S t...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Structured Programming with go to Statements DONALD E. KNUTH Stanford University, Stanford, California 9~S05 A consideration of several different examples sheds new light on the problem of ereat- ing reliable, well-structured programs that behave efficiently. This study focuses largely on two issues: (a) improved syntax for iterations and error exits, making it possible to write a larger class of programs clearly and efficiently without go to state- ments; (b) a methodology of program design, beginning with readable and correct, but possibly inefficient programs that are systematically transformed if necessary into efficient and correct, but possibly less readable code. The discussion brings out op- posing points of view about whether or not statements should be abolished; some merit is found on both sides of this question. Fina!ly, an attempt is made to define the true nature of structured programming, and to recommend fruitful direc- tions for further study. Keywords and phrases: structured programming, statements, language design, event indicators, recursion, Boolean variables, iteration, optimization of programs, program transformations, program manipulation systems searching, Quieksort, efficiency CR categories: 4.0, 4.10, 4.20, 5.20, 5.5, 6.1 (5.23, 5.24, 5.25, 5.27) You may go when you will go, And I will stay behind. --Edna St. Vincent Millay [66] Most likely you go your way and I'll go mine. --Song title by Bob Dylan [33] Do you suffer from painful elimination? --Advertisement, J. B. Williams Co. INTRODUCTION A revolution is taking place in the way we write programs and teach programming, be- cause we are beginning to understand the associated mental processes more deeply. It is impossible to read the recent book Struc- tured programming [17; 55] without having it This research was supported in part by the Na- tional Science Foundation under grant number GJ 36473X, and by IBM Corporation. change your life. The reasons for this revolu- tion and its future prospects have been aptly described by E. W. Dijkstra in his 1972 Tur- ing Award Lecture, "The Humble Program- mer" [27l. As we experience this revolution, each of us naturally is developing strong feelings one way or the other, as we agree or disagree with the revolutionary leaders. I must admit to being a nomhumble programmer, egotisti- Copyright (~) 1974, Association for Computing Machinery, Inc. General permission to republish, but not for profit, all or part of this material is granted, provided that ACM's copyright notice is given and that reference is made to this publication, to its date of issue, and to the fact that reprint- ing privileges were granted by permission of the Association for Computing Machinery. Computing Surveys, V?L 6, No. 4, Dee, ember 1974
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
262 , Donald E. Knuth CONTENTS INTRODUCTION 1. ELIMINATION OF so to STATEMENTS Historical Background A Searching Example Efficiency Error Exits Subscript Checking Hash Coding Text Scanning A Confession Tree Searching Systematic Elimination Event Indicators Comparison of Features Simple Iterations 2. INTRODUCTION OF Recursion Elimination Program Manipulation Systems Reeursion vs. Iteration
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/21/2010 for the course ECE 12 taught by Professor Pro.abla during the Winter '09 term at University of Michigan-Dearborn.

Page1 / 41

Structured Programming with go to Statements by Knuth - S t...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online