[PLUG] The joy of refactoring
Rich Shepard
rshepard at appl-ecosys.com
Wed Aug 23 13:01:34 UTC 2017
On Tue, 22 Aug 2017, Alan wrote:
> Sometimes a rewrite is a useful and needed thing.
Thanks, Alan, for allowing us to share our obscure bug experiences on this
thread. :-)
In grad school in 1972 I wrote an ecosystem ecological energy flow model
in FORTRAN IV to run on the U. of Illinois' IBM S/360. It used more than a
whole box of 80-column Hollerith cards for input. When it ran it produed
incorrect results, but only the same 2 or 3 wrong answers each time. So I
printed the source code listing on the wide green-bar paper that all the
line printers used. The output was about 1 inch thick.
I carefully examined each line of code multiple times without seeing the
error. Finally, I took the printed listing to the computer center's help
desk. They examined it without finding the problem.
One day, strictly by chance while looking at a new printed copy (likely
done on a printer with a newer ribbon) I saw the error jump up and bite me
on the nose.
Instead of a loop index written as FOR I = 1 TO N I had mistyped it as FOR
1 = 1 TO N. Distinguishing 1 from the uppercase I was difficult and, because
all of us expected to see I and not 1 in that position we all overlooked it.
Haven't forgotten this after all these years.
Rich
More information about the PLUG
mailing list