home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 5001 < prev    next >
Encoding:
Text File  |  1992-12-16  |  3.3 KB  |  78 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!csn!raven!rcd
  3. From: rcd@raven.eklektix.com (Dick Dunn)
  4. Subject: Re: C code Layout
  5. Message-ID: <1992Dec16.083733@eklektix.com>
  6. Organization: eklektix - Boulder, Colorado
  7. References: <1992Dec14.175533.8400@fcom.cc.utah.edu> <1992Dec14.235521.1557@cbnewsm.cb.att.com> <KANZE.92Dec15171105@slsvdnt.us-es.sel.de>
  8. Date: Wed, 16 Dec 1992 08:37:33 GMT
  9. Lines: 67
  10.  
  11. kanze@us-es.sel.de (James Kanze) writes:
  12. >lfd@cbnewsm.cb.att.com (Lee Derbenwick) writes:
  13. >|> One reason that I personally dislike very large comments embedded in
  14. >|> the code is that they greatly reduce the amount of code within my
  15. >|> visual field (whether on a screen or on paper):...
  16. ...
  17.  
  18. Scott McGregor talks about the same phenomenon (and some of the tradeoffs
  19. surrounding it) in considerably more detail.  But it's a good point in any
  20. case.
  21.  
  22. [Kanze applies name "band width theory"]
  23. >the number of characters [the page] can contain, and the goal is to use
  24. >this band width in an optimal fashion.)
  25.  
  26. This, by itself, seems a straightforward statement.  Since what we've been
  27. talking about is, after all, how to convey information beyond what the code
  28. itself says, isn't there some goal to use the available space in an optimal
  29. fashion?  Not a "most compact" fashion, mind you..."optimal" refers to
  30. "best", not "smallest".
  31.  
  32. >Of course, this means that you also put several short statements on
  33. >the same line, code on the same line as the opening brace, etc...
  34.  
  35. No, it doesn't mean that.  Where is it written that "optimal" means
  36. "extreme to the point of obvious stupidity"?
  37.  
  38. There are cases where you might put several short statements on a line, if
  39. they're intimately related to one another.  For example,
  40.     t = x0;  x0 = x1;  x1 = t;
  41. This is a single operation, a simple "exchange x0, x1".  But the criterion
  42. is not merely "short"; it is "intimately related".
  43.  
  44. And even K&R style, one of the more compact C styles, does not put code on
  45. the same line as the opening brace.
  46.  
  47. In other words, you are trying to set up a straw man, and you have been
  48. insufficiently subtle, so your device is found out even by dullards like
  49. me.
  50.  
  51. >...And of course, you never, never leave a line blank.
  52.  
  53. More strawman.
  54.  
  55. >This also argues for short variable names.  (They increase the chances
  56. >of getting more than one statement on a line.)
  57.  
  58. Apparently you've succeeded in ignoring the real reason for short variable
  59. names--even though it's well known and has also been discussed here
  60. recently: a common practice, in natural as well as artificial language, to
  61. use the most compact forms for the most common words.
  62.  
  63. >In case it's not obvious from the tone of my comments, I am in total
  64. >disagreement with this style.
  65.  
  66. In case it's not obvious from the tone of my reply, I am pointing out
  67. that the "style" with which you totally disagree is an invention of your
  68. own imagination.
  69.  
  70. The remainder of this discussion has mostly moved in the direction of
  71. noting the endpoints of common usage and exploring the ground in between.
  72. You do no service--unless you are simply looking for baseless argument--
  73. by staking out ground outside where the rest of us stand, and arguing that
  74. it is wrong.
  75. -- 
  76. Dick Dunn    rcd@eklektix.com   -or-   raven!rcd    Boulder, Colorado USA
  77.    ...Mr. Natural says, "Use the right tool for the job."
  78.