home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pmafire!news.dell.com!swrinde!elroy.jpl.nasa.gov!ames!pacbell.com!UB.com!igor!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Newsgroups: comp.lang.c++
- Subject: Re: GOTO, was: Tiny proposal for na
- Message-ID: <rmartin.715447981@thor>
- Date: 2 Sep 92 15:33:01 GMT
- References: <714668024@thor> <6800007@tisdec.tis.tandy.com> <rmartin.714863091@thor> <2318@devnull.mpd.tandem.com> <rmartin.715001372@thor> <4192@papaya.bbn.com>
- Sender: news@Rational.COM
- Lines: 47
-
- cbarber@bbn.com (Chris Barber) writes:
-
- |Well I must admit that it seems that most people posting on this topic
- |say that they do not use gotos, even those who disagree with you. So I
- |guess I will just have to come out of the closet and admit that I have
- |been using them for several years and with no regrets. I can't recall
- |finding any bugs that were related to my use of gotos and I haven't heard
- |any complaints about the readability of my code. In fact, I resent your
- |implication that because I use gotos I am lazy and write unstructured
- |code.
-
- Code which uses gotos in a manner which is inconsistent with one of
- the 3 control structures of structured programming is not structured.
- This does not mean that it doesn't have a structure, of course it
- does. But it does mean that it is not "structured" according to the
- tenets of SP.
-
- Are you lazy? I doubt it. But you have decided to ignore some of the
- lessons of the past.
-
- [traditional example of error processing eliminated]
-
- There are lots of ways of using gotos which appear relatively benign,
- perfectly safe, easy to read, easy to maintain ... at least to the
- author. And, if he gets no complaints, then perhaps he was right. Or
- perhaps he was wrong. Absence of complaint is not a mandate.
-
- Before "Structured Programming", we all used gotos. And not all our
- programs were maintenance monsters. Many were quite elegant, well
- thought out, flexible and robust. So what?
-
- We have since learned that writing algorithms that conform to the
- principles of structured programming can enhance the robustness and
- maintainability of the code. When you violate those principles, you
- take a needless risk. You may be satisfied that the risk was worth
- it, but so what? You aren't the only one who will be responsible for
- your code. Others will come after, and have to work through the same
- reasoning that you did to assure themelves that your "way" is safe.
-
-
-
-
- --
- Robert Martin Training courses offered in:
- R. C. M. Consulting Object Oriented Analysis
- 2080 Cranbrook Rd. Object Oriented Design
- Green Oaks, Il 60048 (708) 918-1004 C++
-