On 15 Jun 2021 15:07:15 -0700, in bit.listserv.ibm-main
(Message-ID:<[email protected]>)
[email protected] (Bob Bridges) wrote:
Like most programmers (maybe), I had some habits that I no
longer tolerate.
A couple of quotes are applicable here:
Always code as if the person who ends up maintaining your
code will be a violent psychopath who knows where you live.
-Martin Golding
And one time when I posted an old program, I said: "I
disavow any bad coding, as it belongs to a much younger
version of myself."
For example:
1) I used to hate long-winded variable names. Ok, that's
a bad example to
start with, because I still do. But I no longer use
one-character variable
names, ever
My first languages were BASIC & Fortran, and I still see
nothing wrong with loop variables of I, J, & K.
For anything more complex, I do use names that make sense.
Or I try to. I recently rewrote a program and had to figure
out what some variable names meant. I kept the names
(because they *were* descriptive), but included a block
comment at the beginning explaining them.
2) I know everyone says to comment your work, but I never
used to.
I've found it useful to have a block of comments (or at
least a one-liner) at the beginning of each program,
explaining what it does. Too often I've had to read through
a whole program to figure out what it did, and whether it
was (supposed to be) a one-shot. An account of how it does
what it does can also be useful, but that tends not to
change when the program itself does.
5) One thing hasn't changed: Like most of us here, I was
~always~ rabid
about proper indentation.
I am no longer so fond of my "standard" for REXX
indentation. But with decades of old code, I continue it
rather than change to something I'd actually prefer. I
steal too much from my old code to be happy changing to
something incompatible.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN