home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13290 < prev    next >
Encoding:
Internet Message Format  |  1992-09-04  |  2.4 KB

  1. From: kers@hplb.hpl.hp.com (Chris Dollin)
  2. Date: Fri, 4 Sep 1992 07:29:31 GMT
  3. Subject: Re: Re: GOTO, was: Tiny proposal for named loops.
  4. Message-ID: <KERS.92Sep4082931@cdollin.hpl.hp.com>
  5. Organization: Hewlett-Packard Laboratories, Bristol, UK.
  6. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!scd.hp.com!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
  7. Newsgroups: comp.lang.c++
  8. References: <2318@devnull.mpd.tandem.com> <rmartin.715001372@thor> <4192@papaya.bbn.com> <1992Sep2.131733.20676@terminator.cc.umich.edu> <r
  9. Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
  10. Lines: 40
  11. In-Reply-To: rmartin@thor.Rational.COM's message of 3 Sep 92 13:23:02 GMT
  12. Nntp-Posting-Host: cdollin.hpl.hp.com
  13.  
  14. In article ... rmartin@thor.Rational.COM (Bob Martin) writes:
  15.  
  16.    You don't have to make up your own rules.  Some other guys, who have
  17.    thought about it alot, have put together a pretty well thought through
  18.    set of rules.  Moreover, the industry has, for the most part, accepted
  19.    those rules as valid.  Moreover, it has been proven that those rules
  20.    are always workable, and it has been shown that they help to make code
  21.    more readable and maintainable.  
  22.  
  23. In what sense do you claim that ``these rules'' (by which I understand you to
  24. mean the usual rules of structured programming) have been ``proven'' to be
  25. ``workable''? 
  26.  
  27. It's certainly true that any procedure can be rewritten in structured style
  28. (ie, using only while, if, and sequencing as control structures). But the
  29. easiest proof of this -- turn it into a loop wrapped round a case (chained ifs,
  30. if you want to be picky) -- also shows that it's not necessarily a good idea,
  31. if what you want is *clear* code.
  32.  
  33. And clearness is as much a matter of psychology as of mathematics. There's a
  34. lot of empirical evidence to suggest that traditional SP ``works'', ie, that 
  35. for very many programming problems, they are an effective solution. [The
  36. evidence is the large number of programs written effectively in that style.]
  37. But there's also evidence that they're not *enough* -- that other control
  38. structures are needed for clarity -- consider
  39.  
  40.     * procedures
  41.     * FOR-loops (of various kinds)
  42.     * N+1/2 times loops
  43.     * Scheme-style use of tail-call
  44.     * Co-routines
  45.     * Higher-order functions
  46.  
  47. for example.
  48.  
  49.  
  50. --
  51.  
  52. Regards,    | "If taking devious pains was a sign of laziness, he was quite
  53. Kers.       | prepared to call Hazelton the laziest man alive." Blish (m-o-l)
  54.