正在加载图片...
Go To Statement Considered Harmful Edsger W.Dijkstra Reprinted from Communications of the ACM,Vol.11,No.3,March 1968,pp.147-148.Copyright 1968,Association for Computing Machinery,Inc. This is a digitized copy derived from an ACM copyrighted work.It is not guaranteed to be an accurate copy of the author's original work. Key Words and Phrases: go to statement,jump instruction,branch instruction,conditional clause,alternative clause,repetitive clause,program intelligibility,program sequencing CR Categories: 4.22,6.23,5.24 Editor: For a number of years I have been familiar with the observation that the quality of programmers is a decreasing function of the density of go to statements in the programs they produce.More recently I discovered why the use of the go to statement has such disastrous effects,and I became convinced that the go to statement should be abolished from all "higher level" programming languages(i.e.everything except,perhaps,plain machine code).At that time I did not attach too much importance to this discovery;I now submit my considerations for publication because in very recent discussions in which the subject turned up,I have been urged to do so. My first remark is that,although the programmer's activity ends when he has constructed a correct program,the process taking place under control of his program is the true subject matter of his activity,for it is this process that has to accomplish the desired effect;it is this process that in its dynamic behavior has to satisfy the desired specifications.Yet,once the program has been made,the "making'of the corresponding process is delegated to the machine. My second remark is that our intellectual powers are rather geared to master static relations and that our powers to visualize processes evolving in time are relatively poorly developed.For that reason we should do our utmost to shorten the conceptual gap between the static program and the dynamic process,to make the correspondenceGo To Statement Considered Harmful Edsger W. Dijkstra Reprinted from Communications of the ACM, Vol. 11, No. 3, March 1968, pp. 147-148. Copyright © 1968, Association for Computing Machinery, Inc. This is a digitized copy derived from an ACM copyrighted work. It is not guaranteed to be an accurate copy of the author's original work. Key Words and Phrases: go to statement, jump instruction, branch instruction, conditional clause, alternative clause, repetitive clause, program intelligibility, program sequencing CR Categories: 4.22, 6.23, 5.24 Editor: For a number of years I have been familiar with the observation that the quality of programmers is a decreasing function of the density of go to statements in the programs they produce. More recently I discovered why the use of the go to statement has such disastrous effects, and I became convinced that the go to statement should be abolished from all "higher level" programming languages (i.e. everything except, perhaps, plain machine code). At that time I did not attach too much importance to this discovery; I now submit my considerations for publication because in very recent discussions in which the subject turned up, I have been urged to do so. My first remark is that, although the programmer's activity ends when he has constructed a correct program, the process taking place under control of his program is the true subject matter of his activity, for it is this process that has to accomplish the desired effect; it is this process that in its dynamic behavior has to satisfy the desired specifications. Yet, once the program has been made, the "making' of the corresponding process is delegated to the machine. My second remark is that our intellectual powers are rather geared to master static relations and that our powers to visualize processes evolving in time are relatively poorly developed. For that reason we should do our utmost to shorten the conceptual gap between the static program and the dynamic process, to make the correspondence
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有