home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13264 < prev    next >
Encoding:
Text File  |  1992-09-03  |  3.3 KB  |  69 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!gumby!destroyer!terminator!potts
  3. From: potts@itl.itd.umich.edu (Paul Potts)
  4. Subject: Re: GOTO, was: Tiny proposal for na
  5. Message-ID: <1992Sep3.175118.12466@terminator.cc.umich.edu>
  6. Sender: news@terminator.cc.umich.edu (Usenet Owner)
  7. Organization: Instructional Technology Laboratory, University of Michigan
  8. References: <4192@papaya.bbn.com> <1992Sep2.131733.20676@terminator.cc.umich.edu> <rmartin.715526582@thor>
  9. Date: Thu, 3 Sep 1992 17:51:18 GMT
  10. Lines: 57
  11.  
  12. In article <rmartin.715526582@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  13. >potts@itl.itd.umich.edu (Paul Potts) writes:
  14. >
  15. >|I use "goto" sparingly as well, and agree that it can be very useful in
  16. >|cases, and even make code *more* readable. BASICally <grin> I use it 
  17. >|only to exit from loops where adding additional conditions to the loop
  18. >|would make the code much more obscure and slow, or to skip down past a
  19. >|piece of code to the end of the loop under some circumstances. 
  20. >
  21. >|To make GOTO more readable, NEVER go backwards in your code, only
  22. >|forwards; use only one GOTO in a block, and comment explicitly. If GOTO
  23. >|is used only under certain conditions, the argument against writing
  24. >|spaghetti code really doesn't apply.
  25. >
  26. >Paul, though you rail against the proscription of goto, you have
  27. >simply replaced it with several proscriptions and warnings of your own
  28. >making.  You tell us NEVER to do some things, and to "skip down" in
  29. >"some circumstances" and "use only one" in others.  
  30. >
  31. >I am sure that there are others who might disagree with your "one goto
  32. >per block" rule.  Others may disagree with your "NEVER go backwards"
  33. >rule.
  34. >
  35.  
  36. Look again at what I wrote. I never used the word "rule" in my post.
  37. I said "To make GOTO more readable." These are clearly my suggestions.
  38. I find uses for GOTO. I find that these guidelines help, and these are
  39. the situations in which I feel that using GOTO doesn't make my code
  40. less readable or more difficult to maintain.
  41.  
  42. >
  43. >You don't have to make up your own rules.  Some other guys, who have
  44. >thought about it alot, have put together a pretty well thought through
  45. >set of rules.  
  46.  
  47. Guys like... You? Ooh, could you teach me?
  48.  
  49. This is more-than-vaguely insulting. I am perfectly familiar with the
  50. tenets of structured programming. It looks like our writer is assuming
  51. that my ".edu" domain means that I am an untutored student just beginning
  52. to learn programming. This simply isn't the case.
  53.  
  54. >So, why invent your own?
  55.  
  56. My own what? I haven't written any rules here.
  57. My own guidelines, suggestions, occasional method of coding,
  58. my own code? Isn't that what programming *is*? I study guidelines, books,
  59. C++ Report, Journal of Object-Oriented Programming, class libraries,
  60. other programmer's code, and take what I find useful from these sources. 
  61. I strive to write readable and maintainable code, and I am now working to
  62. develop my skills as a C++ programmer. That's why I read this group. None
  63. of these activities preclude the occasional use of GOTO. Into the kill file...
  64. -- 
  65. "...remove protective cap. Hold atomizer with thumb at base and nozzle 
  66. between first and second fingers. Without tilting head, insert nozzle into 
  67. nostril. Fully depress rim with a firm, even stroke and sniff deeply."
  68. -advice for presidential candidates from Paul Potts - potts@itl.itd.umich.edu
  69.