A Conversation for The GOTO Statement

"There I was..." -- stories of GOTO

Post 1

Spherical Cows Incorporated

Surely many of us have had our own unique experiences of the GOTO statement... why not share a few for those unfortunates who grew up with structured programming (or OOPS, for that matter!).

I taught myself programming, back at the dawn of the world when people still loaded the boot programs with switches and paper tape and punchcards (though the move was on to (gasp) terminals). Needless to say it was all assembly and BASIC, with a dash of FORTRAN and COBOL.

My first summer job (for which I was woefully unprepared... I still feel guilty for the $600 a month the poor company paid me, though it was in fact way below standard) was at a major software developer who wrote Big Programs for Big Government in Big Languages (pretty much all COBOL).
Great was my shock when they instructed us which of the features of the language we were allowed to use, and which we weren't. Telling us that we had to do things THIS way and not THAT seemed like an affront to our creativity, and anal to boot. Especially since we couldn't use GOTO. I mean, how could you optimise code without GOTOs?! Besides using WHILE statements was awkward, messy, and unnatural!

It wasn't until the next summer, when I was working at a particle accelerator in Vancouver, that I came to appreciate the point. At some point my supervisor -- a wonderfully crusty and enthusiastic Scottish engineer -- handed me a binder and asked me to make some modifications to the code to produce graphs and optimise the magnetic fields in the ion accelerator. He reverently informed me that the program had been developed over years of effort and that there was the work of more than one Nobel Laureate in there.
Somewhere! I have no idea how many lines of code there were, certainly over 10,000... and it was all shards of ancient dialects of FORTRAN strung together with GOTOs. Some subroutines had comments; most of the older ones did not. It was like solving a jigsaw puzzle in hell, you know... with the edges of the pieces blackening and curling while one worked! Amazing!
I eventually got some graphs, and I hope they were right. The Cyclotron's still going years later, so it can't be THAT bad, and I'm told it did boost the efficiency. But I might as well have been reading entrails as code. I've been a big believer in structured programming ever since!

Except that now we have Object Oriented Programming and other things which, while infinitely better in many ways, are just as hard to figure out as GOTOs in my (limited) experience. I foresee the need for more scrying and vision-questing than ever!


"There I was..." -- stories of GOTO

Post 2

Is mise Duncan

The dropping of goto and adoption of OOP etc. is part of a natural progression caused (in part) by the fact that computers are becoming ever cheaper and programmers are becoming ever more expensive. We have now passed the point where it is worth sacrificing readability for processing speed - in commercial applications, anyway.

That said, I have met people who have said things like "comments make my source code bigger and therefore slower to load up" so there's always a contrary viewpoint.


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more