Objective Evidence Against Gotos

Irrefutable proof that gotos will not be helping the programmers of the future:

Reminiscent of the actual Cobol Tombstone:


Can it be objectively proven that control-structure blocks are "better" than goto's? (regardless of personal preference)

MuAnswer. Better for what purpose?

That's part of the issue to discuss. Perhaps some background. Some have alleged that certain technologies are objectively better. The goto issue is used as a testing ground of proving techniques.

I've rarely seen people allege certain technologies are objectively better without providing implicitly or explicitly a 'purpose'. The proposed 'goto issue' remains an invalid testing ground until offered a similar basis.

I would say "Developer productivity", but I doubt that is specific enough for you. However, the topic intro is not the place to hash it out in my opinion.

Most of the above are generalized thought experiments, not rigorous counts. [1] Some may argue that the choice of tests is subjective, but at least how the numbers come about is objective.

It doesn't matter whether they were motivated for subjective reasons; every choice you ever make is objective.

The above clearly shows a) how difficult it is to make general statements and b) how easy it is to uselessly criticize them.

The first poster should have clearly delimited his context. Given no context allows all kinds of counterpoints even ones that are silly and unhelpful. The first poster could have written: Probably nobody would have disagreed with the finding that GoTo is worse at this task.

One could then list more uses of GoTo and probably find more areas where GoTo is not that useful (e.g. conditionals).

But an exhaustive list of GoTo usages is hard to get (though I bet there are disertations about this out there). I have no difficulty giving examples where a GoTo is more readable than the normal structured means. First among these being a simple StateMachine simulation. Every solution that decomposes this into loop+switch or lots of state classes or using recursion is inherently less readable and the state-transitions are more difficult to follow.

This quickly leans to the conclusion that GoTo is not inherently evil but - as always - the usage is. No GoldenHammer, but no TracelessPoison? either.

More involved and heated discussion about goto evidence in ObjectiveEvidenceAgainstGotosDiscussion.

See also: GotoConsideredHarmful, BickeringConsideredHarmful
CategoryMetrics, CategoryBranchingAndFlow


EditText of this page (last edited May 16, 2013) or FindPage with title or text search