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