The title of Edsger Dijkstra’s 1968 “Go To Statement Considered Harmful” is among the best-known phrases in the history of programming. Interestingly, the phrasing of the title — which has become so regular a cliche in the field it inspired Eric Meyer to compose the waggish “‘Considered Harmful’ Essays Considered Harmful” — was not Dijkstra’s work at all. As Dijkstra explained it:
Finally a short story for the record. In 1968, the Communications of the ACM published a text of mine under the title “The goto statement considered harmful,” which in later years would be most frequently referenced, regrettably, however, often by authors who had seen no more of it than its title, which became a cornerstone of my fame by becoming a template: we would see all sorts of articles under the title “X considered harmful” for almost any X, including one titled “Dijkstra considered harmful.” But what had happened? I had submitted a paper under the title “A case against the goto statement”, which, in order to speed up its publication, the editor had changed into a “letter to the Editor”, and in the process he had given it a new title of his own invention! The editor was Niklaus Wirth.
How did Wirth come up with the odd phrase? My hunch is: some combination of English-as-a-second-language (though, since Wirth got his PhD here at Berkeley, that may be completely wrong) combined with the essential trait of radical concision drummed into the heads of programmers of that era. Fewer words! Fewer characters! Less space in memory!
The content of Dijkstra’s brief essay itself is far less widely known than its title. David Tribble, the author of an extensive annotation of the original essay, calls it “probably the least read document in all of programming lore” — hyperbole, but telling.
As Tribble and others have pointed out, Dijkstra didn’t advocate the total elimination of “go to,” but he did aim to radically curtail it: “The go to statement as it stands is just too primitive; it is too much an invitation to make a mess of one’s program.”
Dijsktra’s essay was an important milestone in the structured programming movement of its era. His argument is straightforward enough: “Go to” is problematic because, in jumping arbitrarily from one spot in a process to another, it fails to maintain context (or “state awareness”) — and that invites messes.
From what I can tell, the specifics of this debate have been largely left behind by the march of programming-language progress. Nonetheless I found plenty to chew on in Dijkstra’s brief essay, particular his assertion that the programmer’s “true subject matter” is creating the “process taking place under control of his program,” with the program and its code serving simply a means to that end.
I wonder what practicing programmers reading these arguments today make of them. Are there analogies in today’s languages to Dijkstra’s “invitation to make a mess”? Higher-level-abstraction versions of the “Go To” statement that we have yet to eliminate? Should “Go To Statement Considered Harmful” be on the software-document reading list at all — or should we let it age peacefully into its cliche-dom?
There are no revisions for this post.