Contributed Columns

The following rules for programmers were published 19 years ago. Enjoy this glimpse at The Way Things Were... and still are!

-Joe Horn-

APHORISMS FOR PROGRAMMERS

Bill Kolb (265)

"PPC Journal," September 1979

Volume 6, Number 6, Page 19

The following is a collection of observations and general principles for programmers. It should remind us that Murphy's Laws apply to calculator enthusiasts as much as anyone. If you are an experienced programmer, you can probably testify to the truth of most; if you are a beginner, you may as well resign yourself. So before you rush out to buy the HP-41c or the HP-34c, you may want to meditate on the following.

Fundamental Laws of Computer Arithmetic: A = A +/- something in the last place. A+B is not equal to B+A. AB is not equal to BA. A(B+C) is not equal to AB+AC. A^n is not equal to A times itself n times. Reversing an operation won't get you back.

Computers do what you tell them to do, not what you want them to do. (Ingerman's Law)

No one will have as high an opinion of your programs as you.

No program is completely debugged.

No program is fool-proof.

The first person to use your program will find an error.

No program works the first time. Be especially leery if you get the expected answer on the first run.

When all else fails in debugging a program, explain it to a seven year old child.

The longer it takes to debug a program, the more likely it will be recorded with the program switch on RUN.

[That erased the program in RAM. -jkh-]

Each half-hour of analysis saves two hours of programming and debugging.

A program's usefulness is inversely proportional to the time spent on it. (Morgenstern's Law)

It's far easier to write a new program than modify an old one.

Any problem has more than one solution. Corollary: No two programs are alike.

Ninety-five percent of the time is spent on five percent of the problem.

Most problems with your calculator can be traced to not reading the manual.

Manuals are useless when you have a problem.

Variables don't, constants aren't. (Osborn's Law)

An integer isn't.

Variables will be known with greater accuracy than constants.

Using more digits will make your answers more believable.

Having a sophisticated calculator is no excuse for confusing the problem.

EXAMPLE: 1+1

Solution on a Four-Function Calculator:

2.00

Solution on the HP-67:

LN(lim((1+1/z)^z,z->inf)+sin(w)^2+cos(w)^2

No calculator will have all the features you want.

Useful features won't be convenient; the features you want won't be used.

A fifty percent increase in memory doubles the capacity of a computer.

There are at least two ways to save three steps in any program.

You never have enough memory.

Any program can be improved.

A long run is more likely to crash at the end than at the beginning.

[!!!!! -jkh-]

When you want to use LASTx, the stack will be in the wrong order.

Inside every large program is a small program struggling to get out. (Hoare's Law)

Inside every large program is a small program struggling to defeat the purpose of the large program. (Joe's Law)

You cannot successfully determine beforehand which side of the bread to butter. (Law of the Perversity of Automata)

Basic Laws of Programming: Any given program, when running, is obsolete. Any given program costs more and takes longer. If a program is useful, it will have to be changed. If a program is useless, it will have to be documented.