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

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!UB.com!igor!thor!rmartin
  2. From: rmartin@thor.Rational.COM (Bob Martin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: GOTO, was: Tiny proposal for na
  5. Message-ID: <rmartin.714863091@thor>
  6. Date: 26 Aug 92 21:04:51 GMT
  7. References: <714668024@thor> <6800007@tisdec.tis.tandy.com>
  8. Sender: news@Rational.COM
  9. Lines: 45
  10.  
  11. kevinl@tisdec.tis.tandy.com writes:
  12.  
  13.  
  14. |    I have to paritally disagree.  Everytime you add a flag variable,
  15. |you are doubling the number of states for your program.  The more states,
  16. |the more possible paths, and the more paths, the more possible unforseen
  17. |errors (if the paths are not anticipated and tested--something that is
  18. |very hard to do).
  19.  
  20. No, the influence of state variables which control loops is limitted
  21. to the loop condition, and possibly to tests at the completion of the
  22. loop.  Thus, the "doubling" does not occur.
  23.  
  24. |    For experienced programmers, the goto is a legitamite tactic.
  25. |There may not be any cases where a goto is absolutly necessary (I've
  26. |heard that there are some, but I have yet to see any), but putting
  27. |a goto instead of, say, another function call in a path that is called
  28. |10,000 times each time the program is run, saves massive amounts of
  29. |time.
  30.  
  31. Experience is not a license for abuse.  It is the code of the
  32. inexperienced programmers that is hard to read.  The more experienced
  33. the programmer, the easier his code ought to be to read and maintain,
  34. even by the inexperienced.
  35.  
  36. I disagree that goto is a tool for the "experienced" instead I view it
  37. as an error of the inexperienced.  
  38.  
  39. |    I agree that programs are generally easier to understand and
  40. |debug when there are no goto statements, but, if well documented
  41. |gotos are just another structured technique.
  42.  
  43. Oh, I agree that you can write "harmless" gotos.  But the point is
  44. that you don't have to.  A goto is never truly necessary.
  45. Occationally, (very very occationally) you might find a use for a goto
  46. that is actually justified.  But in the last 15 years, I have found
  47. only one, and that was at 2 in the morning after working a few 70 hour
  48. weeks.  In retrospect, the justification might have been based more on
  49. fatigue than fact.  
  50.  
  51. --
  52. Robert Martin                        Training courses offered in:
  53. R. C. M. Consulting                       Object Oriented Analysis
  54. 2080 Cranbrook Rd.                        Object Oriented Design
  55. Green Oaks, Il 60048 (708) 918-1004       C++
  56.