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

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!cis.ohio-state.edu!sample.eng.ohio-state.edu!purdue!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: <BzD7q3.KHr@mentor.cc.purdue.edu>
  6. Sender: news@mentor.cc.purdue.edu (USENET News)
  7. Organization: Purdue University Statistics Department
  8. References: <724478076@sheol.UUCP> <BzCxs6.9oC@mentor.cc.purdue.edu> <1992Dec16.164456.6939@udel.edu>
  9. Date: Wed, 16 Dec 1992 18:37:15 GMT
  10. Lines: 211
  11.  
  12. In article <1992Dec16.164456.6939@udel.edu> carroll@bifur.cis.udel.edu (Mark C. Carroll) writes:
  13. >In article <BzCxs6.9oC@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  14. >]In article <724478076@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:
  15. >]]Again, these points are so simple and so clear that it is
  16. >]]remarkable indeed to have anyone capable of reading and writing
  17. >]]disagree with them as Herman has.   And so I remark upon it.
  18.  
  19. >]]] This is a chicken-and-egg phenomenon.  Most software development does
  20. >]]] not do certain things because the languages, compilers, and the training
  21. >]]] of the programmers does not mention them.  
  22.  
  23. >]]That doesn't answer the question.  Herman specifically requested that
  24. >]]students be exposed to situations where code would "really crawl" unless
  25. >]]heroic and often architecture-specific measures are used to optimize it. 
  26. >]]Such cases are extremely rare, whether or not you believe in a catch-22
  27. >]]deadlock between hardware features and language features, or between
  28. >]]developer capabilities and language features. 
  29.  
  30. >]If the actual code is not used, this may be difficult, but even the 
  31. >]initial idea that a computer manipulates objects, and that how it does
  32. >]this, and what objects it manipulates, are important.  But the idea of
  33. >]bit-twiddling, etc., seems to have been "obvious" to the early people
  34. >]in computing, and the use of binary in the mathematical literature
  35. >]before that time was extremely small.
  36.  
  37. >The idea of bit-twiddling was obvious to the early people in
  38. >computing. But then, the problems of programming weren't very clearly
  39. >understood by them. The idea of a writing a program which required
  40. >hundreds of thousands of lines of machine code was almost beyond their
  41. >imagination, and the problems caused by trying to write, understand,
  42. >debig, and maintain such programs were completely unknown to them.
  43.  
  44. It is true that they did not envision such large machine programs.  Maybe
  45. they were right about it; too often one is confronted with a "package"
  46. which has a few wanted things, lots of items about which one does not
  47. care, and a fair number of supposedly "user friendly" gadgets, which 
  48. are often quite "user inimical."  
  49.  
  50. But the types of operations, etc., required do not change merely because
  51. one has lots of them.  Bits are twiddled because some useful operations
  52. require twiddling bits.  Virtually all branches are binary, with a few
  53. ternary such as sign.
  54.  
  55. >Things have changed. We've learned a lot about programming since then,
  56. >and we've discovered problems that they wouldn't have dreamed of. The
  57. >solutions to their problems aren't necessarily the solutions to ours.
  58. >What was natural to them, isn't necessarily natural to us. 
  59.  
  60. >]]] Unlearning
  61. >]]] provides major obstacles for students in mathematics and statistics, and
  62. >]]] I see no good reason why CS and programming languages should be any
  63. >]]] different in this matter.
  64.  
  65. >]]Precisely my point.  CS students under Herman's regime would have
  66. >]]much to unlearn before they could read, write, or even think about
  67. >]]portable, maintainable software.  These issues may not be important
  68. >]]to Herman, but Herman is the exception.
  69.  
  70. >]They would have to unlearn nothing.  Starting out with the idea that
  71. >]there is a large variety of objects, and that machines operate on them
  72. >]in various ways, WILL cause them to question why the languages place
  73. >]obstacles in their use.
  74.  
  75. >They would have to unlearn a *lot*.
  76.  
  77. >Good programming almost never requires bit-twiddling. It does require
  78. >clarity, modularity, documentation. A good programmer worries about
  79. >how difficult the code s/he writes will be to understand and maintain.
  80. >In general, the maintainability of the code is by far the most
  81. >important concern. Most of the time (virtually all of the time), the
  82. >speed of the code generated by the compiler is more than adequate, and
  83. >any gains to be made by adding bit-twiddling into the programming will
  84. >be more than outwieghed by the additional difficulty in understanding
  85. >and maintaining the code that takes advantage of them.
  86.  
  87. Nothing you have stated here is new.  Unfortunately, much of what is done
  88. now is the opposite of modular.  We have these massive operating systems 
  89. which do millions of things, and certainly the user can do nothing about
  90. separating them most of the time.  So we impose restrictions like object
  91. files have to have their names end in .o, C source files in .c, etc.  This
  92. is NOT modular, it is the reverse of it.  We have moved from 5 or 6 bits/
  93. character to 8, and few systems allow the direct reading and writing of 
  94. these 8-bit characters.  
  95.  
  96. The speed generated by the compiler is only adequate if the facilities
  97. are underused.  Now in many cases, this is not unusual.  It is not often
  98. that the file management mechanism has to be quick in locating files.
  99. And interactive editors do not have to be faster than the typist, EXCEPT
  100. that a shared computer can have many typists on at the same time.  I have
  101. often had to wait for editor response because of system load; doubling the
  102. speed of the executing code would often help a lot.
  103.  
  104. >Most programming doesn't care about the internal representations of
  105. >its information. In most cases, *it doesn't matter*. For example, I'm
  106. >writing a program that does a graphical simulation of a network
  107. >protocol. I'm not worried about speed, because I've already got to
  108. >slow down the execution of my system to let a human being follow it.
  109. >What I am worried about is *correctness* and *maintainability*. 6
  110. >weeks from now, I'll be done with this project, and some other poor
  111. >schmoe is going to have to take it over, and continue work on it. When
  112. >that guy gets hold of it, it's absolutely crucial that
  113. >    (a) my code be understandable, so that he can expand on it
  114. >    (b) my code be correct, so that when he tries to expand it, he isn't
  115. >      forced to waste time discovering my bugs;
  116. >and (c) my code be *clean*, so that when he extends it, my code doesn't
  117. >      break his, and his code doesn't break mine.
  118. >     
  119. My code needs to have the same properties, but I must assume that the 
  120. person maintaining my code understands enough of the underlying mathematics
  121. to know why various things are there.  This can vary from elementary algebra
  122. to graduate material.  Also, I do worry about the interface, and that is one
  123. reason why I feel that pointers, or a darn good substitute for them, is
  124. readily available.
  125.  
  126. In the pre-Unix systems I used, the interfacing problem was usually fairly
  127. easy.  This was not always the case, and interfacing the two calling sequences
  128. on the CDC6x00 often required tweaking assembler code.  But I had no problem
  129. with names on that system; the name that somebody else gave to a program, 
  130. module, entry point, etc., was readily apparent, and it also was relatively
  131. easy to edit if necessary.  Try doing this on the current systems, with all
  132. their introduction of underscores.  The pre-Unix systems were reasonably well
  133. designed to use separate compilation, and the transfer of binary modules.
  134.  
  135. All this was before the "modern" programming era.
  136.  
  137. >]]] The student who takes a typical cookbook mathematics course seems to
  138. >]]] be farther away from eventually understanding than the one who starts
  139. >]]] out with the concepts and theory.
  140.  
  141. >]]But the concepts of and theory of mathematics do not have much to do
  142. >]]with the bit-bumming he recommends early exposure to, so Herman's point
  143. >]]is obscure in the extreme.
  144.  
  145. >]The bit operations are just the binary version of the "standard" decimal
  146. >]operations, and are by no means esoteric, except in the minds of those
  147. >]who would have people grow up ignorant of them.  The goto-laden code I
  148. >]posted was obtained from consideration of how to efficiently use "coin
  149. >]tosses", or other sources of random bits, to produce exponential random
  150. >]variables, and this topic is by no means of recent origin.  Base 2 is
  151. >]useful because it is useful, and not because of arcane considerations.
  152.  
  153. >The bit operations *are* esoteric, because the bit representations are
  154. >generally esoteric. In most programs, the programmer writes code to
  155. >deal with *integers*, not 16bit 2s complement quantities. It's true
  156. >that the concept the programmer wants to deal with may get represented
  157. >in the machine by 16bit 2s complement quantities, but for the purposes
  158. >of the program being written, it doesn't matter. To go back to the
  159. >example of my current project, if I shifted to a machine which used
  160. >64bit 1s complement numbers instead of 32bit 2s complement, it
  161. >wouldn't affect my code a whit.
  162.  
  163. In that case, it means that you do not have to handle numbers whose
  164. magnitude is greater than 2^15 - 1 = 32767.  And except for number
  165. theorists, who damn the current languages as much as I do, those
  166. doing numerical mathematics are concerned at least 99% of the time
  167. with non-integers, except for indices and exponents.  But except 
  168. for Fortran, these are not well handled, anyhow.
  169.  
  170. They are no more esoteric than decimal representations.  The importance
  171. of the "Arabic" numerals was not that they changed computation; in fact,
  172. they did not change computation much, if any.  But they provided a
  173. simpler notation.  Interestingly, the Babylonian system, using base
  174. 60, was quite similar.  
  175.  
  176. The use of truncated decimal expansions was relatively recent.  Somewhat
  177. older, going back to the latter part of the Hellenistic period, is the
  178. same type of sexagesimal notation for numbers in the unit interval.
  179.  
  180. From your statements, I feel it is safe to conclude that numerical computation
  181. is not an important part of what you do--at least numerical computation
  182. involving numbers of much precision.  A quite significant part of the
  183. computation being done is that of good numerical computation.  Now Fortran
  184. was originally intended to be a highly limited language, but Algol was not.
  185. However, a major weakness of Algol was that it did not recognize that the
  186. hardware counted.  If the built-in precision is inadequate, any machine-
  187. independent multiple precision code MUST run slower by a substantial factor.
  188.  
  189.  
  190. >It's true that in *your* problem domain, these things matter. But your
  191. >domain is one, small, narrow niche. The overwhelming majority of us
  192. >who program don't share your concerns - we have our own worries, which
  193. >don't matter to you. But that doesn't mean that we're imcompetent or
  194. >negligent - the problems we're solving are the problems that need to
  195. >be solved for the work done by the largest number of people.
  196.  
  197. So you are saying that numerical analysis is unimportant.  That is the
  198. only conclusion I can draw from your statements.  This agrees with the
  199. conclusions which others have drawn about what is going on in computer
  200. software and hardware.
  201.  
  202. >As I've said before, you're *terribly* ignorant about computer
  203. >science. You don't understand what problems we're trying to solve, and
  204. >you don't care. That's all right - you have your own work to do. But
  205. >so do we. We don't tell you what's wrong with the way you do
  206. >statistics - we're far too ignorant of statistics to be able to
  207. >intelligently comment on your methods. But equally - you're *far* to
  208. >ignorant of computer science, programming languages, and compilers to
  209. >be able to intelligently comment on ours.
  210.  
  211. If someone comes to me with a statistical problem and wants to know how
  212. to solve it with the "standard" tools provided, quite often I have to 
  213. get the problem carefully formulated (usually the client has no idea
  214. what the assumptions being made are), and much of the time I have to
  215. invent a new procedure.  Much of the time this new procedure can be
  216. widely used; some of the time it cannot.  The inventing of new procedures
  217. IS the analog of bit twiddling, as you call it.
  218. -- 
  219. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  220. Phone: (317)494-6054
  221. hrubin@snap.stat.purdue.edu (Internet, bitnet)  
  222. {purdue,pur-ee}!snap.stat!hrubin(UUCP)
  223.