[Coco] GOTO and code maintainability

Bill Barnes da3m0n_slay3r at yahoo.com
Tue Sep 8 00:18:25 EDT 2009


I *believe* it is the abuse, and the failure to RENUM when necessary that some have abused the GOTO command... crazy way to do it. I do believe that a GOTO is OK in the right circumstances... and Yes, it is very much like the assembly mnemonics (and subsequent Machine code) of JMP and BRA. C had a goto that was a blatant goto "label" that could be abused to, and recommended ONLY for code contained in very deeply nested loops. IF a Goto is used properly, I can see it as a for-while, while (condition), or do-while type tool within BASIC. Some even have problems with a do-while loop.

The intolerances of the "Goto" commands/statements is practically ingrained in most programmers for about 2.5 decades, I believe, by computer science and IT programming programs. (with IT, you might or might not run into teaching what is good and bad programming logic instead of a "see monkey do, you do it too."

I run on the philosophy of if there's a better, more logical, and clear way of not using a goto, then I won't. But if needed, will use it appropriately if it's available. I don't like making code spaghetti if I can help it.

-Later!   -WB-    -- BABIC Computer Consulting.


--- On Mon, 9/7/09, John Donaldson <johnadonaldson at sbcglobal.net> wrote:

> From: John Donaldson <johnadonaldson at sbcglobal.net>
> Subject: Re: [Coco] GOTO and code maintainability

> Date: Monday, September 7, 2009, 10:56 AM

> 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



      



More information about the Coco mailing list