Once upon a time, we PPC'ers actually enjoyed *reading* programs, not
just writing and running them. Perhaps the best example of The Joy
of Reading Other People's Programs was given in the following 1978
article. We all got a huge laugh from reading each of the little
programs and the "type of programmer" that Bill said each one
represents. The article drew a ton of replies from all over the
globe... even from HP employees!
Enjoy this glimpse into The Way Things Were...
-Joe-
---------------------------------------------------------------------
WHAT KIND OF PROGRAMMER ARE YOU?
by Bill Kolb (265)
"PPC Journal", V5 N8 P31 (Sep/Oct 1978)
This is a quick test that will help you evaluate yourself as a PPC
programmer. It is based on a similar test by Norman Grabowsky in
DATAMATION Magazine (Mar. 1977). The problem is this: the X-register
[stack level 1] contains either a one or a two. Write a program that
leaves one in the X-register if it previously contained a two, and
vice versa.
AFTER you have written a program, compare your answer with the ones
given below. Select the one that most closely resembles your program
to determine which category you belong to. Look up the meaning of
the category further down in the article.
[Note: This was written in the HP-67 era, so the commands might look
a little strange if you never programmed the old HP PPC's. I took
the liberty of reformatting the programs from vertical listings into
the more HP48-like horizontal listings. If you need to, pretend
that there are << >> around each line! -jkh-]
Category 1:
INT LSTx 2 / INT 2 - 1 +
or 2 / FRAC 2 * 1 +
[See descriptions of each category below. -jkh-]
Category 2:
ENTER x^2 X\=/Y 1 X=Y 2 [ \=/ means "not equals" ]
or Sqrt FRAC X\=/0 1 x=0 2 [ Sqrt means "square root" ]
or X^2 5 - CHS Sqrt
Category 3:
3 X<>Y - [ X<>Y means "SWAP X and Y" ]
or 3 - CHS
Category 4:
1/x ASIN 60 + SIN 1/x
Category 5:
STO_I 1 STO_2 2 STO_1 RCL(i)
or STO_I CLx DSZ RCL_I x=0 11 +
or STO_I CLx GTO(i) LBL_1 1 LBL_2 1 +
Category 6:
RND ABS INT 1 - LSTx X<>Y X=0 GTO_2 X=Y GTO_1 R/S
[continued] LBL_2 + LBL_1 RTN
Category 7:
RND 1 - X=0 2 X\=/0 1
Category 8:
1 X\=/Y CHS +
or 1 - X\=/0 2
Category 9:
1 - X\=/0 1 X=0 2
or 1 X=Y SF2 TF2 2
or 1 X=Y + NOP
Category 10:
1 X=Y 2
or 2 X=Y 1
or 1 X=Y +
or 2 X=Y /
Category 11:
1 X\=/Y R/S + R/S
Category 12:
1 X\=/Y GTO_1 CLx 2 X=Y GTO_2 ...
[continued] LBL_1 2 RTN LBL_2 1 RTN
Category 13:
STO_I GSB(i) ... LBL_1 2 RTN LBL_2 1 RTN
NOW SEE WHAT KIND OF PROGRAMMER YOU ARE:
Category 1: JOB SECURITY MINDED. This is a true work of art. It is
also incomprehensible to anyone else.
Category 2: ENGINEER. This type insists on making the problem more
complicated than it really is. Engineers hang onto an idea
tenaciously until they find a way to make it work.
Category 3: MATHEMATICIAN. This is a concise algorithmic solution to
the problem that completely avoids any tests.
Category 4: SURVEYOR. Surveyors begin every problem by first
converting to a bearing or azimuth. The worst part is that even a
mathematician can't understand their documentation.
Category 5: COMPUTER SCIENTIST. These are likely to be the most
sophisticated solutions to the problem. One can only hope that the
documentation will be good enough to follow what he's doing.
Category 6: SYSTEMS PROGRAMMER. This is actually a very good program.
Every conceivable error trap has been included in case the user makes
a mistake. This type will probably end up selling his calculator.
Category 7: PROGRAMMING INSTRUCTOR. You will notice a number of key
points demonstrated by this program. Unfortunately it doesn't always
work. Chances are he's never produced a working program of any
importance.
Category 8: HP APPLICATIONS ENGINEER. These people really give us
some good programs but somehow they always seem to fall a little
short of the ideal.
Category 9: OLD-LINE HP-65 PROGRAMMER. This type still needs two
steps after every test. Odds are that he bought the HP-67 because he
needed more steps and found out that 224 wasn't enough either.
Category 10: HP-25 OWNER. This is a very short and efficient routine.
Most HP-25 owners can reduce a problem to its simplest terms.
Category 11: BEGINNER. This type knows a little about programming but
doesn't make any distinction between "equals" and "not equals". He
hasn't yet figured out why HP put so many different comparisons on
its calculators.
Category 12: RECENT FOUR-FUNCTION CONVERT. It's apparent that this
programmer is about halfway through the owner's manual and has a good
grasp of the basics. He still spends most of his waking hours trying
to find uses for his calculator.
Category 13: NORMALLY USES A TI CALCULATOR. His own calculator is in
Lubbock, Texas, for the third time. Notice the steadfast refusal to
use the stack.
---------------------------------------------------------------------
[Postscript: In the next issue of the PPC Journal (V5 N9 P5), Richard
Nelson wrote the following. -jkh-]
---------------------------------------------------------------------
A number of 'programmers' at HP also took the test... and as luck
would have it, one produced number 13! Another HP programmer's
solution was a three-step goodie listed below (a). The "best" has to
be Mike Richter's program in (b) below. It is the shortest (will
someone come up with a two-step program?), doesn't use any compares,
labels, flags, registers, or even the stack! [Note: this was very
important on 4-level stack machines! -jkh-]
(a) 2 / 1/x [or 1/x 2 * -jkh-]
(b) 1/x e^x INT
This only proves once again that no matter how "good" a given program
is, most likely someone else can improve it or provide some insight
that facilitates an improvement. It is the exchange of programming
technique that PPC strives to provide.