home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / rec / humor / 34349 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  9.2 KB

  1. Path: sparky!uunet!pipex!warwick!warwick!not-for-mail
  2. From: phudl@csv.warwick.ac.uk (Mr S J Liddicott)
  3. Newsgroups: rec.humor
  4. Subject: A Real Programmer
  5. Date: 19 Nov 1992 19:02:14 -0000
  6. Organization: Computing Services, University of Warwick, UK
  7. Lines: 263
  8. Message-ID: <1egobmINN3hc@clover.csv.warwick.ac.uk>
  9. NNTP-Posting-Host: clover.csv.warwick.ac.uk
  10.  
  11. Don't know who wrote it, but I love it, here it is for all to enjoy.
  12. *----------*-------------------------------------------------------------*
  13. | Sam   Jam|"Never underestimate the importance of a cheap laugh"-       |
  14. | Liddicott| phudl@csv.warwick.ac.uk  | I WAS IN IDAHO | Plucky Duck TTA |
  15. *---------------It's a thing that makes me go hmmm...--------------------*
  16. P.S. Lets all test together - do a TEST, be WILD, go on, do a TEST cascade
  17.  
  18. From: Alexander Jones <ALJ11@phx.cam.ac.uk>
  19.  
  20. Subject: Real programmers
  21.  
  22. A recent article devoted to the *macho* side of programming
  23. made the bald and unvarnished statement:
  24.  
  25.       Real Programmers write in ForTran.
  26.  
  27. Maybe they do now,
  28. in this decadent era of
  29. Lite beer, hand calculators and "user-friendly" software
  30. but back in the Good Old Days,
  31. when the term "software" sounded funny
  32. and Real Computers were made out of drums and vacuum tubes,
  33. Real Programmers wrote in machine code.
  34. Not ForTran.  Not RATFOR.  Not, even, assembly language.
  35. Machine code.
  36. Raw, unadorned, inscrutable hexadecimal numbers.
  37. Directly.
  38.  
  39. Lest a whole new generation of programmers
  40. grow up in ignorance of this glorious past,
  41. I feel duty-bound to describe,
  42. as best I can through the generation gap,
  43. how a Real Programmer wrote code.
  44. I'll call him Mel,
  45. because that was his name.
  46.  
  47. I first met Mel when I went to work for Royal McBee Computer Corp.,
  48. a now-defunct subsidiary of the typewriter company.
  49. The firm manufactured the LGP-30,
  50. a small, cheap (by the standards of the day)
  51. drum-memory computer,
  52. and had just started to manufacture
  53. the RPC-4000, a much-improved,
  54. bigger, better, faster -- drum-memory computer.
  55. Cores cost too much,
  56. and weren't here to stay anyway.
  57. (That's why you haven't heard of the company, or the computer.)
  58.  
  59. I had been hired to write a ForTran compiler
  60. for this new marvel and Mel was my guide to its wonders.
  61. Mel didn't approve of compilers.
  62.  
  63. "If a program can't rewrite its own code,"
  64. he asked, "what good is it ?"
  65.  
  66. Mel had written
  67. in hexadecimal
  68. the most popular computer program the company owned.
  69. It ran on the LPG-30
  70. and played blackjack with potential customers
  71. at computer shows.
  72. Its effect was always dramatic.
  73. The LPG-30 booth was packed at every show,
  74. and the IBM salesmen stood around
  75. talking to each other.
  76. Whether or not this actually sold computers
  77. was a question we never discussed.
  78.  
  79. Mel's job was to re-write
  80. the blackjack program for the RPC-4000.
  81. (Port? What does that mean ?)
  82. The new computer had a one-plus-one
  83. addressing scheme,
  84. in which each machine instruction,
  85. in addition to the operation code
  86. and the address of the needed operand,
  87. had a second address that indicated where, on the revolving drum,
  88. the next instruction was located.
  89. In modern parlance,
  90. every single instruction was followed by a GOTO !
  91. Put *that* in Pascal's pipe and smoke it.
  92.  
  93. Mel loved the RPC-4000
  94. because he could optimise his code:
  95. that is, locate instructions on the drum
  96. so that just as one finished its job,
  97. the next would be just arriving at the "read head"
  98. and available for immediate execution.
  99. There was a program to do that job,
  100. an "optimising assembler",
  101. but Mel refused to use it.
  102.  
  103. "You never know where its going to put things",
  104. he explained, "so you'd have to use separate constants."
  105.  
  106. It was a long time before I understood that remark.
  107. Since Mel knew the numerical value
  108. of every operation code,
  109. and assigned his own drum addresses,
  110. every instruction he wrote could also be considered
  111. a numerical constant.
  112. He could pick up an earlier "add" instruction, say,
  113. and multiply by it,
  114. if it had the right numeric value.
  115. His code was not easy for someone else to modify.
  116.  
  117.  
  118. I compared Mel's hand optimised programs
  119. with the same code massaged by the optimising assembler program,
  120. and Mel's always ran faster.
  121. That was because the "top-down" method of program design
  122. hadn't been invented yet,
  123. and Mel wouldn't have used it anyway.
  124. He wrote the innermost parts of his program loops first,
  125. so they would get the first choice
  126. of the optimum address locations on the drum.
  127. The optimising assembler wasn't smart enough to do it that way.
  128.  
  129. Mel never wrote time-delay loops, either,
  130. even when the balky Flexowriter
  131. required a delay between output characters to work right.
  132. He just located instructions on the drum
  133. so each successive one was just *past* the read head
  134. when it was needed;
  135. the drum had to execute another complete revolution
  136. to find the next instruction.
  137. He coined an unforgettable term for this procedure.
  138. Although "optimum" is an absolute term,
  139. like "unique", it became common verbal practice
  140. to make it relative:
  141. "not quite optimum" or "less optimum"
  142. or "not very optimum".
  143. Mel called the maximum time-delay locations
  144. the "most pessimum".
  145.  
  146. After he finished the blackjack program
  147. and got it to run
  148. ("Even the initialiser is optimised",
  149. he said proudly)
  150. he got a Change Request from the sales department.
  151. The program used an elegant (optimised)
  152. random number generator
  153. to shuffle the "cards" and deal from the "deck",
  154. and some of the salesmen felt it was too fair,
  155. since sometimes the customers lost.
  156. They wanted Mel to modify the program
  157. so, at the setting of a sense switch on the console,
  158. they could change the odds and let the customer win.
  159.  
  160. Mel balked.
  161. He felt this was patently dishonest,
  162. which it was,
  163. and that it impinged on his personal integrity as a programmer,
  164. which it did,
  165. so he refused to do it.
  166. The Head Salesman talked to Mel,
  167. as did the Big Boss and, at the boss's urging,
  168. a few Fellow Programmers.
  169. Mel finally gave in and wrote the code,
  170. but he got the test backwards,
  171. and, when the sense switch was turned on,
  172. the program would cheat, winning every time.
  173. Mel was delighted with this,
  174. claiming his subconcious was uncontrollably ethical,
  175. and adamently refused to fix it.
  176.  
  177. After Mel had left the company for greener pa$ture$,
  178. the Big Boss asked me to look at the code
  179. and see if I could find the test and reverse it.
  180. Somewhat reluctantly, I agreed to look.
  181. Tracking Mel's code was a real adventure.
  182.  
  183. I have often felt that programming is an art form,
  184. whose real value can only be appreciated
  185. by another versed in the same arcane art;
  186. there are lovely gems and brilliant coups
  187. hidden from human view and admiration, sometimes forever,
  188. by the very nature of the process.
  189. You can learn a lot about an individual
  190. just by reading through his code,
  191. even in hexadecimal.
  192. Mel was, I think, an unsung genius.
  193.  
  194. Perhaps my greatest shock came
  195. when I found an innocent loop that had no test in it.
  196. No test. *None*.
  197. Common sense said it had to be a closed loop,
  198. where the program would circle, forever, endlessly.
  199. Program control passed right through it, however,
  200. and safely out the other side.
  201. It took me two weeks to figure it out.
  202.  
  203. The RPC-4000 computer had a really modern facility
  204. called an index register.
  205. It allowed the programmer to write a program loop
  206. that used an indexed instruction inside;
  207. each time through,
  208. the number in the index register
  209. was added to the address of that instruction,
  210. so it would refer
  211. to the next datum in a series.
  212. He had only to increment the index register
  213. each time through.
  214. Mel never used it.
  215.  
  216. Instead, he would pull the instruction into a machine register,
  217. add one to its address,
  218. and store it back.
  219. He would then execute the modified instruction
  220. right from the register.
  221. The loop was written so this additional execution time
  222. was taken into account --
  223. just as this instruction finished,
  224. the next one was right under the drum's read head,
  225. ready to go.
  226. But the loop had no test in it.
  227.  
  228. The vital clue came when I noticed
  229. the index register bit,
  230. the bit that lay between the address
  231. and the operation code in the instruction word,
  232. was turned on --
  233. yet Mel never used the index register,
  234. leaving it zero all the time.
  235. When the light went on it nearly blinded me.
  236.  
  237. He had located the data he was working on
  238. near the top of memory --
  239. the largest locations the instructions could address --
  240. so, after the last datum was handled,
  241. incrementing the instruction address
  242. would make it overflow.
  243. The carry would add one to the
  244. operation code, changing it to the next one in the instruction set:
  245. a jump instruction.
  246. Sure enough, the next program instruction was
  247. in address location zero,
  248. and the program went happily on its way.
  249.  
  250. I haven't kept in touch with Mel,
  251. so I don't know if he ever gave in to the flood of
  252. change that has washed over programming techniques
  253. since those long-gone days.
  254. I like to think he didn't.
  255. In any event,
  256. I was impressed enough that I quit looking for the
  257. offending test,
  258. telling the Big Boss I couldn't find it.
  259. He didn't seem surprised.
  260. When I left the company,
  261. the blackjack program would still cheat
  262. if you turned on the right sense switch,
  263. and I think that's how it should be.
  264. I didn't feel comfortable
  265. hacking up the code of a Real Programmer.
  266.  
  267.  
  268.  
  269. -- 
  270. *----------*-------------------------------------------------------------*
  271. | Sam   Jam|"Never underestimate the importance of a cheap laugh"-       |
  272. | Liddicott| phudl@csv.warwick.ac.uk  | I WAS IN IDAHO | Plucky Duck TTA |
  273. *---------------It's a thing that makes me go hmmm...--------------------*
  274.