home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / fortran / 4771 < prev    next >
Encoding:
Text File  |  1992-12-16  |  9.3 KB  |  170 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!cs.utexas.edu!sdd.hp.com!saimiri.primate.wisc.edu!caen!uvaarpa!murdoch!fermi.clas.Virginia.EDU!gl8f
  3. From: gl8f@fermi.clas.Virginia.EDU (Greg Lindahl)
  4. Subject: Re: Real Programmers (Mel & Blackjack & RPC-4000)
  5. Message-ID: <1992Dec16.175539.12671@murdoch.acc.Virginia.EDU>
  6. Sender: usenet@murdoch.acc.Virginia.EDU
  7. Organization: Department of Astronomy, University of Virginia
  8. References: <MCLAY.92Dec16093918@navier.ae.utexas.edu>
  9. Date: Wed, 16 Dec 1992 17:55:39 GMT
  10. Lines: 158
  11.  
  12. In article <MCLAY.92Dec16093918@navier.ae.utexas.edu> mclay@navier.ae.utexas.edu (Robert McLay) writes:
  13. >
  14. >When this discussion of "Real Programmers" came up in 1984.  There was
  15. >also a poem about Mel and an machine coded blackjack program for a
  16. >drum memory computer (that's right: a drum memory computer). 
  17.  
  18. A poem? Astronomers generally don't write poems, but you can always
  19. ask him if he thinks it's a poem...
  20.  
  21. ----------------------------------------------------------------------
  22.  
  23. Source: usenet: utastro!nather, May 21, 1983.
  24.  
  25.      A recent article devoted to the *macho* side of programming
  26.      made the bald and unvarnished statement:
  27.      
  28.                 Real Programmers write in Fortran.
  29.      
  30. Maybe they do now, in this decadent era of Lite beer, hand calculators and
  31. "user-friendly" software but back in the Good Old Days, when the term
  32. "software" sounded funny and Real Computers were made out of drums and vacuum
  33. tubes, Real Programmers wrote in machine code. Not Fortran. Not RATFOR. Not,
  34. even, assembly language. Machine Code.Raw, unadorned, inscrutable hexadecimal
  35. numbers. Directly. 
  36.      
  37. Lest a whole new generation of programmers grow up in ignorance of this
  38. glorious past, I feel duty-bound to describe, as best I can through the
  39. generation gap, how a Real Programmer wrote code. I'll call him Mel, because
  40. that was his name. 
  41.      
  42. I first met Mel when I went to work for Royal McBee Computer Corp., a
  43. now-defunct subsidiary of the typewriter company. The firm manufactured the
  44. LGP-30, a small, cheap (by the standards of the day) drum-memory computer, and
  45. had just started to manufacture the RPC-4000, a much-improved, bigger, better,
  46. faster -- drum-memory computer. Cores cost too much, and weren't here to stay,
  47. anyway. (That's why you haven't heard of the company, or the computer.) 
  48.      
  49. I had been hired to write a Fortran compiler for this new marvel and Mel was
  50. my guide to its wonders. Mel didn't approve of compilers. 
  51.      
  52. "If a program can't rewrite its own code," he asked, "what good is it?" 
  53.      
  54. Mel had written, in hexadecimal, the most popular computer program the company
  55. owned. It ran on the LGP-30 and played blackjack with potential customers at
  56. computer shows. Its effect was always dramatic. The LGP-30 booth was packed at
  57. every show, and the IBM salesmen stood around talking to each other. Whether
  58. or not this actually sold computers was a question we never discussed. 
  59.      
  60. Mel's job was to re-write the blackjack program for the RPC-4000. (Port?  What
  61. does that mean?) The new computer had a one-plus-one addressing scheme, in
  62. which each machine instruction, in addition to the operation code and the
  63. address of the needed operand, had a second address that indicated where, on
  64. the revolving drum, the next instruction was located. In modern parlance,
  65. every single instruction was followed by a GO TO! Put *that* in Pascal's pipe
  66. and smoke it. 
  67.      
  68. Mel loved the RPC-4000 because he could optimize his code: that is, locate
  69. instructions on the drum so that just as one finished its job, the next would
  70. be just arriving at the "read head" and available for immediate execution.
  71. There was a program to do that job, an "optimizing assembler", but Mel refused
  72. to use it. 
  73.      
  74. "You never know where it's going to put things", he explained, "so you'd have
  75. to use separate constants". 
  76.      
  77. It was a long time before I understood that remark. Since Mel knew the
  78. numerical value of every operation code, and assigned his own drum addresses,
  79. every instruction he wrote could also be considered a numerical constant. He
  80. could pick up an earlier "add" instruction, say, and multiply by it, if it had
  81. the right numeric value. His code was not easy for someone else to modify. 
  82.      
  83. I compared Mel's hand-optimized programs with the same code massaged by the
  84. optimizing assembler program, and Mel's always ran faster. That was because
  85. the "top-down" method of program design hadn't been invented yet, and Mel
  86. wouldn't have used it anyway. He wrote the innermost parts of his program
  87. loops first, so they would get first choice of the optimum address locations
  88. on the drum. The optimizing assembler wasn't smart enough to do it that way. 
  89.      
  90. Mel never wrote time-delay loops, either, even when the balky Flexowriter
  91. required a delay between output characters to work right. He just located
  92. instructions on the drum so each successive one was just *past* the read head
  93. when it was needed; the drum had to execute another complete revolution to
  94. find the next instruction. He coined an unforgettable term for this procedure.
  95. Although "optimum" is an absolute term, like "unique", it became common verbal
  96. practice to make it relative: "not quite optimum" or "less optimum" or "not
  97. very optimum". Mel called the maximum time-delay locations the "most
  98. pessimum". 
  99.      
  100. After he finished the blackjack program and got it to run, ("Even the
  101. initializer is optimized", he said proudly) he got a Change Request from the
  102. sales department. The program used an elegant (optimized) random number
  103. generator to shuffle the "cards" and deal from the "deck", and some of the
  104. salesmen felt it was too fair, since sometimes the customers lost. They wanted
  105. Mel to modify the program so, at the setting of a sense switch on the console,
  106. they could change the odds and let the customer win. 
  107.      
  108. Mel balked. He felt this was patently dishonest, which it was, and that it
  109. impinged on his personal integrity as a programmer, which it did, so he
  110. refused to do it. The Head Salesman talked to Mel, as did the Big Boss and, at
  111. the boss's urging, a few Fellow Programmers. Mel finally gave in and wrote the
  112. code, but he got the test backwards, and, when the sense switch was turned on,
  113. the program would cheat, winning every time. Mel was delighted with this,
  114. claiming his subconscious was uncontrollably ethical, and adamantly refused to
  115. fix it. 
  116.      
  117. After Mel had left the company for greener pa$ture$, the Big Boss asked me to
  118. look at the code and see if I could find the test and reverse it. Somewhat
  119. reluctantly, I agreed to look. Tracking Mel's code was a real adventure. 
  120.      
  121. I have often felt that programming is an art form, whose real value can only
  122. be appreciated by another versed in the same arcane art; there are lovely gems
  123. and brilliant coups hidden from human view and admiration, sometimes forever,
  124. by the very nature of the process. You can learn a lot about an individual
  125. just by reading through his code, even in hexadecimal. Mel was, I think, an
  126. unsung genius. 
  127.      
  128. Perhaps my greatest shock came when I found an innocent loop that had no test
  129. in it. No test. *None*. Common sense said it had to be a closed loop, where
  130. the program would circle, forever, endlessly. Program control passed right
  131. through it, however, and safely out the other side. It took me two weeks to
  132. figure it out. 
  133.      
  134. The RPC-4000 computer had a really modern facility called an index register.
  135. It allowed the programmer to write a program loop that used an indexed
  136. instruction inside; each time through, the number in the index register was
  137. added to the address of that instruction, so it would refer to the next datum
  138. in a series. He had only to increment the index register each time through.
  139. Mel never used it. 
  140.      
  141. Instead, he would pull the instruction into a machine register, add one to its
  142. address, and store it back. He would then execute the modified instruction
  143. right from the register. The loop was written so this additional execution
  144. time was taken into account -- just as this instruction finished, the next one
  145. was right under the drum's read head, ready to go. But the loop had no test in
  146. it. 
  147.      
  148. The vital clue came when I noticed the index register bit, the bit that lay
  149. between the address and the operation code in the instruction word, was turned
  150. on-- yet Mel never used the index register, leaving it zero all the time. When
  151. the light went on it nearly blinded me. 
  152.      
  153. He had located the data he was working on near the top of memory -- the
  154. largest locations the instructions could address -- so, after the last datum
  155. was handled, incrementing the instruction address would make it overflow. The
  156. carry would add one to the operation code, changing it to the next one in the
  157. instruction set: a jump instruction. Sure enough, the next program instruction
  158. was in address location zero, and the program went happily on its way. 
  159.      
  160. I haven't kept in touch with Mel, so I don't know if he ever gave in to the
  161. flood of change that has washed over programming techniques since those
  162. long-gone days. I like to think he didn't. In any event, I was impressed
  163. enough that I quit looking for the offending test, telling the Big Boss I
  164. couldn't find it. He didn't seem surprised. 
  165.  
  166. When I left the company, the blackjack program would still cheat if you turned
  167. on the right sense switch, and I think that's how it should be. I didn't feel
  168. comfortable hacking up the code of a Real Programmer.
  169.  
  170.