Naming variables or procedures
Even the concept of a variable or procedure name isn't universally
understood.
When I took a COBOL course, my programmes' card decks (yes, it was that
long ago) were
almost[1]
invariably four to ten times as large as other
students' decks. This was because I used long, descriptive names for
everything and included lots of comments for readability. Some of the
other students noticed that my programmes usually ran correctly the first
time while they were still trying to debug theirs for days or weeks after.
They started asking me to help with their programmes.
One student brought me a printout of his buggy programme for advice.
I can't remember exactly what it did or didn't do. What I do remember
is stuff like:
PERFORM JOHN. [...] PERFORM MARY. [...] PERFORM SUSAN. [...]
PERFORM RICHARD. [....]
| Luser: |
"The professor said we had to use names for the
paragraphs." |
| [1] |
I took one of my programmes, deleted all of the comments, changed all
of the user-defined names to single characters and reduced the thing to
one page. The PROCEDURE DIVISION was reduced from three or four pages to
eight lines. I would show the original and the obfuscated versions to
one of the other students and ask them which of the two they would prefer
to have to modify. They were surprised that they both compiled to the
exact same code.
|
Date posted: 10th March 2000