[Coco] GOTO and code maintainability
Wayne Campbell
asa.rand at yahoo.com
Mon Sep 7 15:29:06 EDT 2009
I do not believe that the use of GOTO is bad or wrong. It is the same as a BRA or a JMP, just as GOSUB is the same as BSR and JSR. All either does is establish an instruction branch, with the subroutine version requiring a return (RTS).
It is the old use of GOTO by some BASIC programmers in an attempt to make their code difficult to figure out that gave GOTO a bad name. In its place, and with proper use, GOTO can make code smaller and easier to read.
Wayne
________________________________
From: John Donaldson <johnadonaldson at sbcglobal.net>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Monday, September 7, 2009 8:56:27 AM
Subject: Re: [Coco] GOTO and code maintainability
Is not a GOTO the same thing as a JMP or BRA command in Assembly??? I have used JMP and BRA commands many times in Assembly programs.
John Donaldson
Aaron Banerjee wrote:
>
> All of us have at least at one point in time either used, or tried to figure out code containing GOTO statements. In a recent programming environment I was in, GOTO (or it's equivalent in whatever language we happened to be programming) was expressly forbidden -- no exceptions no matter what.
>
> Just to be an irritant, I chucked a single GOTO (to make a polling loop) in a relatively simple program, which totally confused my colleagues.
>
> Given that it isn't abused, I don't see why GOTO makes code any less maintainable than other obviscation techniques, such as polymorphism (which, while useful, if abused can lead to very multiple inheritance or exception-based program control. At least GOTO tells you where it is going....
>
> Has anyone else run into this type of "GOTO intolerance" while programming?
>
> - Aaron
>
> -- Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
--
--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list