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

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!uw-beaver!cornell!rochester!udel!louie!gloin.cis.udel.edu!carroll
  3. From: carroll@gloin.cis.udel.edu (Mark C. Carroll)
  4. Subject: Re: Safety.  Was: Re: Pointers
  5. Message-ID: <1992Dec18.164648.1857@udel.edu>
  6. Sender: usenet@udel.edu (USENET News Service)
  7. Nntp-Posting-Host: gloin.cis.udel.edu
  8. Organization: University of Delaware, Newark
  9. References: <BzCxs6.9oC@mentor.cc.purdue.edu> <1992Dec16.164456.6939@udel.edu> <BzD7q3.KHr@mentor.cc.purdue.edu>
  10. Date: Fri, 18 Dec 1992 16:46:48 GMT
  11. Lines: 331
  12.  
  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. ]]]In article <724478076@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:
  17. ]]]]Again, these points are so simple and so clear that it is
  18. ]]]]remarkable indeed to have anyone capable of reading and writing
  19. ]]]]disagree with them as Herman has.   And so I remark upon it.
  20. ]
  21. ]]]]] This is a chicken-and-egg phenomenon.  Most software development does
  22. ]]]]] not do certain things because the languages, compilers, and the training
  23. ]]]]] of the programmers does not mention them.  
  24. ]
  25. ]]]]That doesn't answer the question.  Herman specifically requested that
  26. ]]]]students be exposed to situations where code would "really crawl" unless
  27. ]]]]heroic and often architecture-specific measures are used to optimize it. 
  28. ]]]]Such cases are extremely rare, whether or not you believe in a catch-22
  29. ]]]]deadlock between hardware features and language features, or between
  30. ]]]]developer capabilities and language features. 
  31. ]
  32. ]]]If the actual code is not used, this may be difficult, but even the 
  33. ]]]initial idea that a computer manipulates objects, and that how it does
  34. ]]]this, and what objects it manipulates, are important.  But the idea of
  35. ]]]bit-twiddling, etc., seems to have been "obvious" to the early people
  36. ]]]in computing, and the use of binary in the mathematical literature
  37. ]]]before that time was extremely small.
  38. ]
  39. ]]The idea of bit-twiddling was obvious to the early people in
  40. ]]computing. But then, the problems of programming weren't very clearly
  41. ]]understood by them. The idea of a writing a program which required
  42. ]]hundreds of thousands of lines of machine code was almost beyond their
  43. ]]imagination, and the problems caused by trying to write, understand,
  44. ]]debug, and maintain such programs were completely unknown to them.
  45. ]
  46. ]It is true that they did not envision such large machine programs.  Maybe
  47. ]they were right about it; too often one is confronted with a "package"
  48. ]which has a few wanted things, lots of items about which one does not
  49. ]care, and a fair number of supposedly "user friendly" gadgets, which 
  50. ]are often quite "user inimical."  
  51.  
  52. Stick to the issue. We aren't talking about user interfaces here...
  53. Programs have grown in size - we do things on our computers every day
  54. that require incredible amounts of code to support - even if we
  55. completely ignoring the quantity of code that supports user
  56. interfaces.  Programs have grown, dramatically.
  57.  
  58. Just for example: I'm using a network protocol specification system
  59. called Estelle. I've got an Estelle protocol analyzer based on a
  60. system called Pet. The complete Pet system, including analysis and
  61. simulation of protocols is well over a megabyte of object code. That's
  62. a HUGE amount of code to deal with.
  63.  
  64. I have to extend Pet to do a particular kind of simulation. I've got
  65. over 1 megabyte of code written by someone else to deal with. That
  66. megabyte includes not one line of user-interface code, because I'm
  67. using the stripped down command-line system. Now - what's going to be
  68. more important to me? Knowing that my simulations will run 20% faster,
  69. or knowing that I can build on top of pet without having to dig into
  70. its internals to understand every facet of its implementation?
  71.  
  72. ]But the types of operations, etc., required do not change merely because
  73. ]one has lots of them.  Bits are twiddled because some useful operations
  74. ]require twiddling bits.  Virtually all branches are binary, with a few
  75. ]ternary such as sign.
  76.  
  77. Why does this seem to be a non-sequitur to me? What does bit-twiddling
  78. have to do with the binary nature of most branches?
  79.  
  80. ]]]]] Unlearning
  81. ]]]]] provides major obstacles for students in mathematics and statistics, and
  82. ]]]]] I see no good reason why CS and programming languages should be any
  83. ]]]]] different in this matter.
  84. ]
  85. ]]]]Precisely my point.  CS students under Herman's regime would have
  86. ]]]]much to unlearn before they could read, write, or even think about
  87. ]]]]portable, maintainable software.  These issues may not be important
  88. ]]]]to Herman, but Herman is the exception.
  89. ]
  90. ]]]They would have to unlearn nothing.  Starting out with the idea that
  91. ]]]there is a large variety of objects, and that machines operate on them
  92. ]]]in various ways, WILL cause them to question why the languages place
  93. ]]]obstacles in their use.
  94. ]
  95. ]]They would have to unlearn a *lot*.
  96. ]
  97. ]]Good programming almost never requires bit-twiddling. It does require
  98. ]]clarity, modularity, documentation. A good programmer worries about
  99. ]]how difficult the code s/he writes will be to understand and maintain.
  100. ]]In general, the maintainability of the code is by far the most
  101. ]]important concern. Most of the time (virtually all of the time), the
  102. ]]speed of the code generated by the compiler is more than adequate, and
  103. ]]any gains to be made by adding bit-twiddling into the programming will
  104. ]]be more than outwieghed by the additional difficulty in understanding
  105. ]]and maintaining the code that takes advantage of them.
  106. ]
  107. ]Nothing you have stated here is new.  Unfortunately, much of what is done
  108. ]now is the opposite of modular.  We have these massive operating systems 
  109. ]which do millions of things, and certainly the user can do nothing about
  110. ]separating them most of the time.  So we impose restrictions like object
  111. ]files have to have their names end in .o, C source files in .c, etc.  This
  112. ]is NOT modular, it is the reverse of it.  We have moved from 5 or 6 bits/
  113. ]character to 8, and few systems allow the direct reading and writing of 
  114. ]these 8-bit characters.  
  115. ]
  116.  
  117. Another non-sequitur. You're confusing several different, completely
  118. independent issues.
  119.  
  120. File naming conventions have nothing to do with language design. The
  121. fact the Unix prefers you to name your C code files *.c, and your C
  122. header files *.h doesn't have _any_ relationship to the modularity or
  123. lack of it in the C language.
  124.  
  125. The fact that the brain-dead operating system that most of us are
  126. forced to use has a monolithic kernel has nothing to do with whether
  127. or not we write modular programs.
  128.  
  129. Those are two different issues, which have absolutely *nothing* to do
  130. with what I was talking about. Regardless of the OS kernel being used,
  131. and regardless of the file system naming conventions being used, a
  132. good program is still written modularly. 
  133.  
  134.  
  135. ]The speed generated by the compiler is only adequate if the facilities
  136. ]are underused.  Now in many cases, this is not unusual.  It is not often
  137. ]that the file management mechanism has to be quick in locating files.
  138. ]And interactive editors do not have to be faster than the typist, EXCEPT
  139. ]that a shared computer can have many typists on at the same time.  I have
  140. ]often had to wait for editor response because of system load; doubling the
  141. ]speed of the executing code would often help a lot.
  142.  
  143. Not at all true.
  144.  
  145. In many cases, the code generated by the compiler is faster than the
  146. code you'd write. The compiler can keep track of more information than
  147. you can, and it can use that information in ways that you probably
  148. wouldn't. So, regardless of whether or not the machine is being used
  149. to its full potential, the compiler generated code may be better than
  150. the human generated code. In most other cases, the speed difference
  151. between hand tuned code and machine optimized code is negligable. (In
  152. a code without a deeply nested, tight inner loop, saving 2
  153. instructions in a sequence of 10 does not produce a significant speed
  154. difference.)
  155.  
  156.  
  157. ]]Most programming doesn't care about the internal representations of
  158. ]]its information. In most cases, *it doesn't matter*. For example, I'm
  159. ]]writing a program that does a graphical simulation of a network
  160. ]]protocol. I'm not worried about speed, because I've already got to
  161. ]]slow down the execution of my system to let a human being follow it.
  162. ]]What I am worried about is *correctness* and *maintainability*. 6
  163. ]]weeks from now, I'll be done with this project, and some other poor
  164. ]]schmoe is going to have to take it over, and continue work on it. When
  165. ]]that guy gets hold of it, it's absolutely crucial that
  166. ]]    (a) my code be understandable, so that he can expand on it
  167. ]]    (b) my code be correct, so that when he tries to expand it, he isn't
  168. ]]      forced to waste time discovering my bugs;
  169. ]]and (c) my code be *clean*, so that when he extends it, my code doesn't
  170. ]]      break his, and his code doesn't break mine.
  171. ]]     
  172. ]My code needs to have the same properties, but I must assume that the 
  173. ]person maintaining my code understands enough of the underlying mathematics
  174. ]to know why various things are there.  This can vary from elementary algebra
  175. ]to graduate material.  Also, I do worry about the interface, and that is one
  176. ]reason why I feel that pointers, or a darn good substitute for them, is
  177. ]readily available.
  178.  
  179. No, your code doesn't! You've demonstrated that in the code you've
  180. posted to the net, and in your continual explanations of your
  181. programming style. Your code is written *strictly* for efficiency, and
  182. any other consideration goes out the window in order to save a clock
  183. cycle. That's not necessarily a bad thing - for the problem domain
  184. you're working in. But that doesn't mean that every other programmer
  185. in the world has the same concerns that you do. Most of us have other
  186. things that take preference. For the applications I'm writing, making
  187. my code clear and safe is far more important than reducing my runtime
  188. by 5%, or even by 50%. For the people who will be using my code, it's
  189. much more important that they be able to *easily* build on top of it,
  190. than that it take 5 minutes less to finish a simulation.
  191.  
  192. What you fail to understand is, there are many different problem
  193. domains in the world. Your domain is only one of them, and it's a
  194. relatively small niche. The things that are problems for may not
  195. necessarily be problems in other domains - and the things that are
  196. solutions for you may not be solutions for other domains. In many
  197. domains, your solutions aren't solutions at all - they are *severe*
  198. problems. That doesn't mean that the people working in the other
  199. problem areas are idiots, or incompetents. It doesn't make the
  200. solutions to their problems foolish. They're not solving the same
  201. problems that you're solving!
  202.  
  203. ]In the pre-Unix systems I used, the interfacing problem was usually fairly
  204. ]easy.  This was not always the case, and interfacing the two calling sequences
  205. ]on the CDC6x00 often required tweaking assembler code.  But I had no problem
  206. ]with names on that system; the name that somebody else gave to a program, 
  207. ]module, entry point, etc., was readily apparent, and it also was relatively
  208. ]easy to edit if necessary.  Try doing this on the current systems, with all
  209. ]their introduction of underscores.  The pre-Unix systems were reasonably well
  210. ]designed to use separate compilation, and the transfer of binary modules.
  211. ]
  212.  
  213. And again I ask: what does this have to do with the design of current
  214. programming languages? Yes, I'll be the first to admit to you that the
  215. Unix linker has a fundementally brain-dead system of handling names.
  216. But what does that have to do with *anything*?
  217.  
  218. ]]]The bit operations are just the binary version of the "standard" decimal
  219. ]]]operations, and are by no means esoteric, except in the minds of those
  220. ]]]who would have people grow up ignorant of them.  The goto-laden code I
  221. ]]]posted was obtained from consideration of how to efficiently use "coin
  222. ]]]tosses", or other sources of random bits, to produce exponential random
  223. ]]]variables, and this topic is by no means of recent origin.  Base 2 is
  224. ]]]useful because it is useful, and not because of arcane considerations.
  225. ]
  226. ]]The bit operations *are* esoteric, because the bit representations are
  227. ]]generally esoteric. In most programs, the programmer writes code to
  228. ]]deal with *integers*, not 16bit 2s complement quantities. It's true
  229. ]]that the concept the programmer wants to deal with may get represented
  230. ]]in the machine by 16bit 2s complement quantities, but for the purposes
  231. ]]of the program being written, it doesn't matter. To go back to the
  232. ]]example of my current project, if I shifted to a machine which used
  233. ]]64bit 1s complement numbers instead of 32bit 2s complement, it
  234. ]]wouldn't affect my code a whit.
  235.  
  236. ]In that case, it means that you do not have to handle numbers whose
  237. ]magnitude is greater than 2^15 - 1 = 32767.
  238.  
  239. It depends on what I'm doing. In my network simulator, I rarely have
  240. to deal with numbers larger than 100. In other things I code, I deal
  241. with arbitrarily large numbers - and so I use a language that allows
  242. me to use arbitrarily large numbers. 
  243.  
  244.  
  245. ]...  And except for number
  246. ]theorists, who damn the current languages as much as I do, those
  247. ]doing numerical mathematics are concerned at least 99% of the time
  248. ]with non-integers, except for indices and exponents.  But except 
  249. ]for Fortran, these are not well handled, anyhow.
  250.  
  251. Really? So what's wrong with the numeric system in Scheme, or
  252. Commonlisp?
  253.  
  254. Or the numeric class system in Haskell?
  255.  
  256. Or the numeric type system in Sisal?
  257.  
  258. Or have you just never bothered to look at any of them??
  259.  
  260. ]They are no more esoteric than decimal representations.  The importance
  261. ]of the "Arabic" numerals was not that they changed computation; in fact,
  262. ]they did not change computation much, if any.  But they provided a
  263. ]simpler notation.  Interestingly, the Babylonian system, using base
  264. ]60, was quite similar.  
  265.  
  266. But I don't use decimal representations either. I use *integers*, and
  267. I don't care if they are represented as binary, ternary, octal,
  268. decimal, duodecimal - what do I care? 
  269.  
  270. ]From your statements, I feel it is safe to conclude that numerical computation
  271. ]is not an important part of what you do--at least numerical computation
  272. ]involving numbers of much precision. 
  273.  
  274. True. And from your statements, I feel that it is safe to conclude
  275. that implementing large software systems is not a part of what you do.
  276. Surprise! We each do what we're good at.
  277.  
  278. ]
  279. ]]It's true that in *your* problem domain, these things matter. But your
  280. ]]domain is one, small, narrow niche. The overwhelming majority of us
  281. ]]who program don't share your concerns - we have our own worries, which
  282. ]]don't matter to you. But that doesn't mean that we're imcompetent or
  283. ]]negligent - the problems we're solving are the problems that need to
  284. ]]be solved for the work done by the largest number of people.
  285. ]
  286. ]So you are saying that numerical analysis is unimportant.  That is the
  287. ]only conclusion I can draw from your statements.  This agrees with the
  288. ]conclusions which others have drawn about what is going on in computer
  289. ]software and hardware.
  290.  
  291. No, I'm not saying that numerical anaylsis in unimportant. I *am*
  292. saying that numerical analysis is only one of the many areas of
  293. computation that is important. And I am further saying that your area
  294. is only one niche in numerical analysis, and that your solutions
  295. probably aren't broadly applicable outside your area.
  296.  
  297. ]]As I've said before, you're *terribly* ignorant about computer
  298. ]]science. You don't understand what problems we're trying to solve, and
  299. ]]you don't care. That's all right - you have your own work to do. But
  300. ]]so do we. We don't tell you what's wrong with the way you do
  301. ]]statistics - we're far too ignorant of statistics to be able to
  302. ]]intelligently comment on your methods. But equally - you're *far* to
  303. ]]ignorant of computer science, programming languages, and compilers to
  304. ]]be able to intelligently comment on ours.
  305. ]
  306. ]If someone comes to me with a statistical problem and wants to know how
  307. ]to solve it with the "standard" tools provided, quite often I have to 
  308. ]get the problem carefully formulated (usually the client has no idea
  309. ]what the assumptions being made are), and much of the time I have to
  310. ]invent a new procedure.  Much of the time this new procedure can be
  311. ]widely used; some of the time it cannot.  The inventing of new procedures
  312. ]IS the analog of bit twiddling, as you call it.
  313.  
  314. You're describing exactly what's wrong with your approach. You haven't
  315. ever bothered to formulate your problem carefully, and you haven't
  316. ever bothered to learn anything about the background of what you're
  317. talking about.
  318.  
  319. No one has claimed that the languages that you're using are
  320. well-suited to the problems your trying to solve. I really do believe
  321. that none of the current languages that are available will do the job
  322. you want done. But your arguments are so strongly rooted in what you
  323. don't know that you're not managing to tell anyone what you need, and
  324. you're offending a lot of people along the way. You're never going to
  325. get what you need unless you stop flaming, and learn enough to be able
  326. to describe what you need. I'm not studying to be a numerical analyst;
  327. I'm studing to be a compiler specialist. If you want me to build you a
  328. compiler that does what you want, you've got to be able to tell me
  329. what you want. 
  330.  
  331. If you can't be bothered to do that, then you're just wasting your
  332. time flaming the language design community for not designing your
  333. language. No one is going to do your job for you. You want it? Go
  334. ahead and tell us what you want, and you'll get it.
  335.  
  336.     <MC>
  337.  
  338.  
  339. -- 
  340. || Mark Craig Carroll: <MC>     ||"I prize the cloudy, tearing sky,
  341. || Univ of Delaware, Dept of CIS|| for the thoughts that flap and fly.
  342. || Grad Student/Labstaff Hacker || For staying in and reading by.
  343. || carroll@udel.edu             || For sitting under" -Karen Peris
  344.