Edsger Dijkstra - The Poetry Of Programming
Written by Mike James   
Article Index
Edsger Dijkstra - The Poetry Of Programming
GOTO considered harmful


In 1964, at a meeting concerned with programming methodology, van Wijngaard explained how to get rid of all GOTO statements using recursion that never returned. This clearly worried Dijkstra because while he felt that the GOTO was dangerous the recursion that replaced it was worse. He spent the evening rewriting the programs so that they didn't have GOTOs in the first place.

What he invented now seems obvious to us but then it was revolutionary.

The idea was simply the DO-LOOP structure which repeated everything between the DO and the LOOP EXIT command which exited the loop.

What Dijkstra found was that this construct got rid of the GOTO without adding anything awful. The next day at the conference, over coffee and lunch, he spent most of the time trying to convince everyone that his new style of programming was the right way to do things.

In 1968 the idea that Dijkstra had come up with burst upon the wider world in a letter to the influential Communications of the ACM entitled,

"The GOTO considered harmful".

The letter was an explanation of why the GOTO was a dangerous command in intellectual terms but it also carried an emotional overtone which many found difficult to take:

"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."


Dijkstra also underestimated the magnitude of the task he had set himself. There are still programmers today who do not understand Dijkstra's argument, even though it has been refined over the years. Dijkstra coined the terms "goto-less programming" and "structured programming" and started a revolution in programming methods.

It is also difficult to appreciate how much reaction there was to the letter. Some programmers did understand at once that Dijkstra's constructions were the way to move forward and get way from the machine architecture. Others thought that it was an unnecessary restriction on their use of the basic machine - the machine works with jumps so should we. It also lead to an amusing set of replies to Dijkstra, amusing to a programmer at least, along the lines of ""Goto Considered Harmful" Considered Harmful "


"""Goto Considered Harmful" Considered Harmful " Considered Harmful"

and so on. 

It is also the source of the "X Considered Harmful" meme that pops up every time someone gets a pet programming hate into their head and wants to make it sound seriously important. 

The paper was seen as an attack by proponents of languages that were based on the Goto and had little chance of being "upgraded" to full structured programming constructs in the near future. Dijkstra wasn't above naming the culprits:

"The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."

"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."

and so on.




It may seem strange the Dijkstra choose to make an emotional attack on something as cold and clinical as an aspect of programming but this was in the nature of the man. He was legendary for not sitting quietly in lecturers and talks by others. Instead he would grow increasingly agitated until an outburst could not be contained any longer.

David Gries recalled a time when he was lecturing with Dijkstra in the audience when he read "x=a" as "x equals a". This is of course a short hand for "assign a to x" and not a statement that x really is logically equal to a. From the back of the room Dijkstra shouted "becomes" and the room fell silent.

Gries thought about it for a moment and said,

"Thank you Edsger, for correcting me. If I make the same mistake again, stop me."

Everything went fine until twenty minutes later he made the same mistake when the shout from the back of the room came again - "becomes". Gries once again thanked Dijkstra and claims to never have made the mistake again. Other lecturers haven't been so lucky.

Dijkstra could be understanding when there was good cause. Once while being shown around a university lab, a Physics PhD commented to him, "You know, Fortran is a great language. The greatest thing about Fortran is its GOTO statement; you know you can branch anywhere you want." The assembled group waited for the explosion but Edsger just smiled.

Dijkstra is also regarded as a "character" in the computer science field. His lecturing style has been described as idiosyncratic. The long pauses between sentences have often been attributed to the fact that English is not Dijkstra's first language. However the pauses also clearly served as a way for him to think on his feet and he was regarded as a quick and deep thinker while engaged in the act of lecturing.

His Dutch origins must have contributed much to his image, especially so when he moved to the States to take up a post at the University of Texas, the Schlumberger Centennial chair in computer sciences. When he was interviewed for the post the vice dean was surprised when Dijkstra turned the tables and virtually started to interview him.

"I was not quite certain just what we might discuss, but Professor Dijkstra soon solved that problem. After some very short preliminaries he stood up and provided me with a lecture on his thoughts on the subject, striding up and down in my office. It is not at all clear to me just who interviewed whom."

Thousands of programmers were taught Dijkstra's ideas on structured programming and many will have used his lecture notes included in the book Structured Programming. Many were, and still are today, puzzled by his approach, his style of writing and his clearly expressed passion for programming.

Many will have reacted violently against what he was saying and it is sometimes said that the structured programming cause could have benefited from not having Dijkstra's vocal support. For example, the first response to the famous "GOTO considered harmful" letter ended,

"I find the emotional tone of this attack as disquieting as the scientific analysis. How many poor, innocent, novice programmers will feel guilty when their sinful use of the GOTO is flailed in this letter."

Dijkstra's response is remarkably restrained. What I am sure he would have liked to say is that they should feel guilty and so should the lecturers who taught them such terrible programming methods!

Although Dijkstra will always be remembered for structured programming, and for his style and approach, he also invented many other of the standard ideas of programming. If you are struggling with multi-threaded programming you may have encountered the semaphore, and the idea of the "deadly embrace". These, and more, are the result of Dijkstra's work on concurrent programming. He showed how this particularly difficult area of programming could be made relatively safe.

Later he concentrated more on the mathematical description of what a program does - its semantics. Unfortunately this work became increasingly abstract and mathematical and beyond the needs of the average programmer. However, perhaps one day it will regarded as revolutionary as structured programming.

Classic books

Although it is old, every programmer would benefit from reading Dijkstra's notes in Structured Programming by Dahl, Dijkstra and Hoare, Academic Press, see side panel. The other two papers are worth reading as well!

To find out about Dijkstra's later work try A Method of Programming by Dijkstra and Feijen.

A Discipline of Programming is a collection of algorithms and Dijkstra's thoughts about them.

More Information


Edsger Dijkstra. The Man Who Carried Computer Science on His Shoulders

Related Articles

The Goto, Spaghetti and the Velociraptor    

Kemeny & Kurtz, inventors of BASIC       

The rise of people power - Computer languages in the 70's      


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Grace Hopper - The Mother of Cobol

Rear Admiral Grace Brewster Murray Hopper was responsible not only for the development of the Cobol language but also for making computers and computing more accessible. Throughout her career she [ ... ]

Robert Metcalfe And Ethernet

How did ARPAnet and ALOHAnet lead to Ethernet and go on to form the basis of the Internet we rely on today? Fifty years on, the man responsible, Robert (Bob) Metcalfe is named the recipient of the 202 [ ... ]

Other Articles

raspberry pi books



or email your comment to: comments@i-programmer.info




<ASIN: 0201175363>


Last Updated ( Thursday, 29 October 2020 )