home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / misc / 4069 < prev    next >
Encoding:
Text File  |  1992-12-21  |  11.5 KB  |  210 lines

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!news.cs.indiana.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
  3. From: hrubin@pop.stat.purdue.edu (Herman Rubin)
  4. Subject: Re: Safety.  Was: Re: Pointers
  5. Message-ID: <BzKCIn.Gr0@mentor.cc.purdue.edu>
  6. Sender: news@mentor.cc.purdue.edu (USENET News)
  7. Organization: Purdue University Statistics Department
  8. References: <1992Dec16.164456.6939@udel.edu> <BzD7q3.KHr@mentor.cc.purdue.edu> <1992Dec18.164648.1857@udel.edu>
  9. Date: Sun, 20 Dec 1992 15:03:59 GMT
  10. Lines: 198
  11.  
  12. In article <1992Dec18.164648.1857@udel.edu> carroll@gloin.cis.udel.edu (Mark C. Carroll) writes:
  13. >In article <BzD7q3.KHr@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  14. >]In article <1992Dec16.164456.6939@udel.edu> carroll@bifur.cis.udel.edu (Mark C. Carroll) writes:
  15. >]]In article <BzCxs6.9oC@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  16.  
  17.             .......................
  18.  
  19. >]]The idea of bit-twiddling was obvious to the early people in
  20. >]]computing. But then, the problems of programming weren't very clearly
  21. >]]understood by them. The idea of a writing a program which required
  22. >]]hundreds of thousands of lines of machine code was almost beyond their
  23. >]]imagination, and the problems caused by trying to write, understand,
  24. >]]debug, and maintain such programs were completely unknown to them.
  25.  
  26. >]It is true that they did not envision such large machine programs.  Maybe
  27. >]they were right about it; too often one is confronted with a "package"
  28. >]which has a few wanted things, lots of items about which one does not
  29. >]care, and a fair number of supposedly "user friendly" gadgets, which 
  30. >]are often quite "user inimical."  
  31.  
  32. >Stick to the issue. We aren't talking about user interfaces here...
  33. >Programs have grown in size - we do things on our computers every day
  34. >that require incredible amounts of code to support - even if we
  35. >completely ignoring the quantity of code that supports user
  36. >interfaces.  Programs have grown, dramatically.
  37.  
  38. Programs, designed essentially for non-numerical purposes, have grown in
  39. size.  But they have grown by attempting to provide too much, while at
  40. the same time not providing enough.  This is even true with many of the
  41. numerical "packages", such as the statistics packages which can provide
  42. far too many of the usually inappropriate cookbook procedures, without
  43. providing for the use of procedures not in the cookbook which are the
  44. ones appropriate for the problems.  An example was the time I needed
  45. to compute exp(z)*erfc(x).  Now I KNEW that often this would be infinity
  46. times 0 if I used the functions as is, so I tweaked the source code to do
  47. this all at once.  This is an easy tweak, and someone who did not even know
  48. the source language would have no problem with it, even with an assembler
  49. source, provided a little programming knowledge was present.  For example,
  50. I could tweak the Lisp code, or APL, and I am barely familiar with those
  51. languages.  But if only the package was available, the situation would
  52. have been hopeless, and I would have had to get an alternate source for
  53. the function, or reprogram it from scratch, using a less efficient 
  54. algorithm, and even facing roundoff problems.
  55.  
  56. Now I am told that using multiple fonts in the same window can be done
  57. in X windows, but that it is a major undertaking.  We have elaborate
  58. typesetting devices, but on the machines accessible to me, we have no
  59. approximation of WYSIWYG, although this has been feasible at low cost
  60. for more than a decade.  I doubt that many of the readers of the net
  61. can write their material half as fast as they could type it with any
  62. remotely readable approximation of WYSIWYG.  
  63.  
  64. I see these brilliant packages providing 10000 "features" which I do not
  65. want, some of which I have found to be more bugs than features, and which
  66. do not privide the 10 which I want.  I include the numerous mouse features,
  67. all of which I would prefer to do from the keyboard; I doubt that anyone 
  68. can move and position the mouse, hold down the relevant buttons and release
  69. them at the right times, etc., as quickly and as accurately as using 
  70. appropriate keyboard manipulations, some of which would have to be added
  71. as additional keys.  
  72.  
  73. >Just for example: I'm using a network protocol specification system
  74. >called Estelle. I've got an Estelle protocol analyzer based on a
  75. >system called Pet. The complete Pet system, including analysis and
  76. >simulation of protocols is well over a megabyte of object code. That's
  77. >a HUGE amount of code to deal with.
  78.  
  79. >I have to extend Pet to do a particular kind of simulation. I've got
  80. >over 1 megabyte of code written by someone else to deal with. That
  81. >megabyte includes not one line of user-interface code, because I'm
  82. >using the stripped down command-line system. Now - what's going to be
  83. >more important to me? Knowing that my simulations will run 20% faster,
  84. >or knowing that I can build on top of pet without having to dig into
  85. >its internals to understand every facet of its implementation?
  86.  
  87. I am familiar with the problems of simulations.  I hope you are not using
  88. any of the currently popular crude pseudo-random numbers to do it.
  89.  
  90. >]But the types of operations, etc., required do not change merely because
  91. >]one has lots of them.  Bits are twiddled because some useful operations
  92. >]require twiddling bits.  Virtually all branches are binary, with a few
  93. >]ternary such as sign.
  94.  
  95. >Why does this seem to be a non-sequitur to me? What does bit-twiddling
  96. >have to do with the binary nature of most branches?
  97.  
  98. People like me, who have no problem understanding them, use the binary 
  99. nature of branching, and otherwise.  Possibly the problems that many have
  100. had in the code which gave rise to the "hrubinstones" have been do to the
  101. lack of binary thinking, which is implicit in the algorithms I proposed.
  102. Now I grew up before binary thinking was of importance; maybe that is why
  103. I can see how to use it profitably :-)
  104.  
  105.             ...................
  106.  
  107. >]]Good programming almost never requires bit-twiddling. It does require
  108. >]]clarity, modularity, documentation. A good programmer worries about
  109. >]]how difficult the code s/he writes will be to understand and maintain.
  110. >]]In general, the maintainability of the code is by far the most
  111. >]]important concern. Most of the time (virtually all of the time), the
  112. >]]speed of the code generated by the compiler is more than adequate, and
  113. >]]any gains to be made by adding bit-twiddling into the programming will
  114. >]]be more than outwieghed by the additional difficulty in understanding
  115. >]]and maintaining the code that takes advantage of them.
  116.  
  117. The first step in good programming is to produce code which will work well
  118. for an adept, and which will do what a pundit will want to accomplish.  
  119. Only then should we put in the bells and whistles and blocks for someone
  120. stupid, who will do stupid things anyhow.  You seem to be concerned ONLY
  121. with providing tools for those doing low-level and routine operations.
  122. This is teaching them to do what the computers will eventually take over.
  123. This is the bane of the present day educational curriculum; the computer
  124. should do what computers can do well, and not try to keep humans from
  125. being innovative.
  126.  
  127. >]Nothing you have stated here is new.  Unfortunately, much of what is done
  128. >]now is the opposite of modular.  We have these massive operating systems 
  129. >]which do millions of things, and certainly the user can do nothing about
  130. >]separating them most of the time.  So we impose restrictions like object
  131. >]files have to have their names end in .o, C source files in .c, etc.  This
  132. >]is NOT modular, it is the reverse of it.  We have moved from 5 or 6 bits/
  133. >]character to 8, and few systems allow the direct reading and writing of 
  134. >]these 8-bit characters.  
  135.  
  136.  
  137. >Another non-sequitur. You're confusing several different, completely
  138. >independent issues.
  139.  
  140. >File naming conventions have nothing to do with language design. The
  141. >fact the Unix prefers you to name your C code files *.c, and your C
  142. >header files *.h doesn't have _any_ relationship to the modularity or
  143. >lack of it in the C language.
  144.  
  145. Prefers is one thing, but having compilers which INSIST on it is another.
  146. Now it must have been language, or compiler, designers who implemented 
  147. the systematic butchering of user names by adding underscores; the 
  148. facilities I used before encountering a UNIX-based system did no such
  149. horror.  This is another example of trying to do too much; someone doing
  150. anything different certainly does not want names changes by the system,
  151. expecially if different languages and compilers are being used.
  152.  
  153. >The fact that the brain-dead operating system that most of us are
  154. >forced to use has a monolithic kernel has nothing to do with whether
  155. >or not we write modular programs.
  156.  
  157. >Those are two different issues, which have absolutely *nothing* to do
  158. >with what I was talking about. Regardless of the OS kernel being used,
  159. >and regardless of the file system naming conventions being used, a
  160. >good program is still written modularly. 
  161.  
  162. And what if the modules cannot be interfaced without going through the
  163. big nuisance of storing intermediate results in what are often massive
  164. files?  Try interfacing two statistical packages.  Try changing the
  165. names in object libraries for which one does not have the assembler
  166. source; the Fortran or C source is not even adequate.  Try making minor
  167. changes without going through a compiler which assumes it knows better
  168. than you what you want to do.
  169.  
  170. >]The speed generated by the compiler is only adequate if the facilities
  171. >]are underused.  Now in many cases, this is not unusual.  It is not often
  172. >]that the file management mechanism has to be quick in locating files.
  173. >]And interactive editors do not have to be faster than the typist, EXCEPT
  174. >]that a shared computer can have many typists on at the same time.  I have
  175. >]often had to wait for editor response because of system load; doubling the
  176. >]speed of the executing code would often help a lot.
  177.  
  178. >Not at all true.
  179.  
  180. >In many cases, the code generated by the compiler is faster than the
  181. >code you'd write. The compiler can keep track of more information than
  182. >you can, and it can use that information in ways that you probably
  183. >wouldn't. So, regardless of whether or not the machine is being used
  184. >to its full potential, the compiler generated code may be better than
  185. >the human generated code. In most other cases, the speed difference
  186. >between hand tuned code and machine optimized code is negligable. (In
  187. >a code without a deeply nested, tight inner loop, saving 2
  188. >instructions in a sequence of 10 does not produce a significant speed
  189. >difference.)
  190.  
  191. The compiler can keep track of more information than I can, but it cannot
  192. use the information in a manner which its producer did not envisage.  Nor
  193. can it use information which it does not have.  
  194.  
  195. That generally compilers can produce code which runs faster than that 
  196. produced by a programmer who only knows what has been taught in the
  197. courses, or is explicit in the manuals, and who does not know how to
  198. think in the symbolism and manner of someone with an undestanding of
  199. the simplicity of abstract mathematics, should be a red flag in the
  200. eyes of the curriculum designers.  Just as I cannot teach someone who
  201. does not understand probability and statistical concepts, but instead
  202. "learns"  statistics from the usual methods courses, how to do statistics 
  203. n a reasonable manner, teaching someone who learns how to program in
  204. Basic or C to do good programming will not be possible.
  205. -- 
  206. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  207. Phone: (317)494-6054
  208. hrubin@snap.stat.purdue.edu (Internet, bitnet)  
  209. {purdue,pur-ee}!snap.stat!hrubin(UUCP)
  210.