[Coco] GOTO and code maintainability

Frank Swygert farna at att.net
Mon Sep 7 17:50:37 EDT 2009


That's what I was thinking... proper use of any command/instructions is useful and makes for better code, abuse is another story. I was never more than a mediocre BASIC programmer. I wrote a couple nice programs, but based them on MS-DOS versions (used them as a guide) and struggled through a lot of the routines. Too much chore for me and not enough fun! But I made neat compact code. The only thing I ever did to "hide" code was to use a loader that made it look like an assembly program on disk. Any competent programmer, even a BASIC programmer, could get around it easy enough. The intent was to keep those who didn't really know what they were doing from altering the code and breaking the program. If you knew enough to get around the loader, you knew enough to alter the code if desired and not later blame the original programmer if things failed to work right later! 

Intentionally making the code difficult to read is just bad programming, period! 

---------
Date: Mon, 7 Sep 2009 12:29:06 -0700 (PDT)
From: Wayne Campbell <asa.rand at yahoo.com>

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.

-- 
Frank Swygert
Publisher, "American Motors Cars" 
Magazine (AMC)
For all AMC enthusiasts
http://farna.home.att.net/AMC.html
(free download available!)




More information about the Coco mailing list