In 1968 Edsger Dijkstra spat upon more than twenty years of computing history by declaring Go To Statement Considered Harmful This was one of foundational hallmarks of the structured programming movement, and subsequently entered into the popular computing culture. It’s true that it’s possible to program without goto, and also true that the larger programs then appearing were beginning to demand more disciplined structure. However, it’s easy to overlook that goto carried the computing world though those first years; during that time it was considered a natural and obvious construct, easy to grasp by minds just beginning to grapple with automated computation.
Recently, an associate of mine handed me a sketch for a web site. Now, this is a man who, though an an expert in his own field and possessed of a remarkable store of knowledge and insight, has often asked me for computing help, and made many statements to the effect of “I hate computers”. His web site sketch indicated links as “Goes to Pg SC-2″ Goto statements. (And symbolic abstraction to boot.) Notice how similar this structure is to BASIC or assembly language.
This associate of mine is decidedly not a digital native. Just as everyone working on computers in the early days was not a digital native. For more than twenty years goto ruled programming because it was the most simple and natural means for humans to approach the problem at hand.
As computer scientists (or analytical artists) we know where this leads: what works well for a half-dozen node DAG becomes a descent into madness as you start scaling up, adding cycles, overlaying other concerns, etc. We use case statements, function calls, polymorphism, and structured programming to chop the mess up into manageable pieces – and in the process make our art inscrutable to the layperson.
As digital natives, we routinely tackle problems of scale and complexity barely dreamed of in Dijkstra’s day, let alone during the reign of goto statements. We know undisciplined use of goto would never tackle these problems. It’s easy to forget that not all problems are this complex. Or that not all people have the background to understand the structured program theorem. In some cases we use highly disciplined gotos called exceptions or continuations – and even among programmers these (continuations especially) are no small source of confusion. It might even be useful to think about the goto hiding in there.
What the great mass of non-computing-professionals understands is what the first languages and computers have always given us: goto statements.