In Favor of GO TO

Some Popular Arguments

In the ongoing debate in comp.lang.cobol, most defenders of GO TO cite at least one of the following arguments: Normally any of these arguments might be considered conclusive. However, the opponents of GO TO use similar arguments with equal fervor. Hence the two sides cancel each other out, and we will not consider these points further.

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?

Some More Interesting Arguments

GO TOs are more efficient than PERFORMs

This assertion may be true, depending on the situation, the compiler, and the compiler options. However, programmers are notorious for guessing wrong about the efficiency of various constructs. Don't use this argument unless you have demonstrated the performance gain in a particular case with some appropriate benchmark.

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.

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.

I couldn't do justice to this argument with a short slogan, so I have discussed it on a separate page.

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.

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.

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.

What's more powerful, a fingernail clipper or a chain saw? Which one would you use for a hangnail?

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.

(I am not making this up. A posting in comp.lang.cobol seriously proposed this curious reasoning in defense of GO TO.)

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."

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.


[home]COBOL Home [style forum]COBOL Style Forum