Why the once-feared goto statement is still lurking in modern code
In short: Structured programming revolutionized software by replacing chaotic goto jumps with predictable blocks. Yet, even as this paradigm became the industry standard, debates over its rigid rules—like the single-exit point—persist. Modern development now balances these structured ideals with practical needs for exception handling, early returns, and complex state management.
Structured programming emerged in the late 1950s with ALGOL 58 and 60, aiming to eliminate spaghetti code caused by the unrestricted use of goto statements. The movement gained momentum following the 1966 structured program theorem by Böhm and Jacopini, which proved that any computable function could be expressed using only sequence, selection, and iteration. Edsger W. Dijkstra further cemented the paradigm with his 1968 open letter, "Go To Statement Considered Harmful."
While the paradigm became ubiquitous, it faced pushback. Donald Knuth argued in 1974 that goto could lead to clearer, more efficient code without sacrificing provability. By the late 20th century, the debate evolved. Critics like Bertrand Meyer viewed modern constructs like break and continue as goto in disguise, while others, such as Kent Beck and Martin Fowler, argued that the strict single-exit rule is often obsolete. They suggest that clarity, rather than rigid adherence to a single exit point, should be the primary goal.
Today, the challenge lies in managing hidden control-flow paths. Exception handling, while necessary for complex systems, introduces paths that are difficult to reason about, as noted by researchers like Westley Weimer and George Necula. Furthermore, specialized environments like OpenMP enforce strict single-exit rules for parallel constructs to maintain stability. Ultimately, modern programming is a hybrid: it relies on structured blocks for readability while utilizing diverse sequencers—like returns, breaks, and exceptions—to handle the realities of software engineering.
Opens the Intellect+ feed with this card first. Swipe up for the next one.
Sources
- Summary by Intellect · source: Structured programming
To cite this card, link to https://intellectplus.co.uk/app/technology-structured-programming.
How we source, check and correct cards: Editorial standards.
General information, not professional advice. Spotted an error? Flag the card or see corrections and complaints.
Intellect Plus is a visual educational discovery platform for exploring fascinating facts and ideas. Brain Food, Not Brain Rot. What is Intellect Plus?
Related
More in Computing and information technology · More in Technology · Latest · A–Z · All topics