Another common tactic is to show a snippet of code -- a trivial loop implemented with a GO TO -- and point out: "See how simple that is?" If all our programs were that simple, no one would complain about GO TO. The nature of sphaghetti is not evident from a single strand. You need a whole plateful.
Sometimes a GO TO partisan will remark that he has seen programs which used PERFORMs instead of GO TOs, and the code was terrible. So what? No one ever promised that the elimination of GO TO would magically lead, by itself, to good code.
Likewise the use of GO TO does not magically lead to bad code. It is possible to write readable and maintainable programs using GO TO to implement the usual constructs of structured programming. The question remains: Why not use those constructs directly, using syntax designed for that purpose?
Even if GO TO is more efficient: does it really matter?
Seldom do a few microseconds here or there make a real difference.
It's usually more important to keep the code readable and maintainable.
CPU cycles are cheaper than brain cycles.
I couldn't do justice to this argument with a short slogan, so I have
discussed it on a separate page.
This argument is bogus. No one argues that GO TOs confuse the CPU.
They confuse programmers, and programmers usually read source code, not
machine language.
What's more powerful, a fingernail clipper or a chain saw? Which one
would you use for a hangnail?
(I am not making this up. A posting in comp.lang.cobol seriously
proposed this curious reasoning in defense of GO TO.)
I responded that fear had nothing to do with it, but facetiously
paraphrased him with the above slogan. He replied: "I like how you
put it."
I couldn't tell if he was serious.
GO TOs make it easier to trace the path of execution
When you're reading the code in deeply nested PERFORMs, it may be
hard to keep track of all the active PERFORMs.
The compiler does it anyway
Even if you don't use GO TOs in your source code, the compiler still
translates your structured programming constructs into the
machine-language equivalent of GO TOs.
GO TO is one of the most powerful statements in the language
Even if one accepts this premise at face value, it hardly seems like a
reason to use GO TO. Rather, it seems like a reason not to. In most
areas of life it's safest to use the least powerful tool which will
still do the job.
The language includes GO TO for a purpose, so you should use it for
that purpose
The same logic, if logic it is, could be applied to ALTER.
GO TO is a sign of courage, a badge of manhood
In an exchange of email, one defender of GO TO told me (among other
things): "It is the mental fear and frame of mind that makes GO TO's
successful or otherwise."
COBOL Home
COBOL Style Forum