Have you heard of the GOTO statement? It was probably the biggest cause of bugs within the early programming languages. Luckily, it is no longer used

Here’s How Not To Suck At Programming

submited by
Style Pass
2021-06-14 14:30:17

Have you heard of the GOTO statement? It was probably the biggest cause of bugs within the early programming languages. Luckily, it is no longer used in most modern programming languages.

But little do we know that we still use its evil cousin daily in modern programming languages, with the same dire consequences.

In the early programmin g languages, before the advent of functions, loops, and if statements, goto was the only way to manage program-control flow.

At the pre-ALGOL meeting held in 1959 Heinz Zemanek explicitly threw doubt on the necessity for GOTO statements; at the time no one paid attention to his remark, including Edsger W. Dijkstra, who later became the iconic opponent of GOTO. The 1970s and 1980s saw a decline in the use of GOTO statements in favor of the “structured programming” paradigm, with goto criticized as leading to “unmaintainable spaghetti code”.

Probably the most famous criticism of GOTO is a 1968 letter by Edsger Dijkstra called Go To Statement Considered Harmful. In that letter Dijkstra argued that unrestricted GOTO statements should be abolished from higher-level languages because they complicated the task of analyzing and verifying the correctness of programs. The letter itself sparked a debate, including a “‘GOTO Considered Harmful’ Considered Harmful” letter sent to Communications of the ACM (CACM) in March 1987, as well as further replies by other people, including Dijkstra’s On a Somewhat Disappointing Correspondence.

Leave a Comment