comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: GOTO considered necessary (reworked)
Date: 1997/06/14
Date: 1997-06-14T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680001406971251590001@news.ni.net> (raw)
In-Reply-To: 5nufle$d1q$1@prime.imagin.net


In article <5nufle$d1q$1@prime.imagin.net>, smize@imagin.net (Samuel Mize)
wrote:

>As I said in my other reply, my main point was just to put a writeup
>somewhere so we can tell people "yes, that's a good question -- the
>issues are discussed in <URL>".
>
>Nobody replied "This is all covered in XXX," so I have to assume that
>there isn't already a good issue-specific write-up to point people at.

Good idea.  Did you talk to Magnus?  Can he add something to the FAQ?

This was the ostensible purpose of the SPC Quality and Style Guidelines;
perhaps we need modify that document to make it more clear when a goto
really is the preferred control structure.

I for one am not averse to these types of discussions.  It's not the goto
itself that's interesting: it's the discussion that it engenders that
creates awareness of the fact that a lot coding standards out there are
pretty silly.  

Any coding convention that says Thou Shalt Not Use Gotos is a silly coding
standard, and we have to make people aware of that.  Implementing a finite
state machine (a scanner, say) is very natural using gotos, and we should
proudly state that in writing somewhere.  Obviously, when a higher-level
control structure will do, use it, but that does not mean never use gotos.

There's a great section in the 2nd ed of Meyer's Object-Oriented Software
Construction (an important book that every software engineer and his
manager should read), where he explains that a "rule" should be phrased as
a "guideline, plus a list of those times when the guideline doesn't apply." 
Shops preparing a coding standard would do well to follow Meyer's advice. 
The goal always is to simplify the code, so a standard should state what
language tools should be used for what kinds of problems, including stating
that gotos are useful for implementing FSMs.

Ada all by itself is a "tool for simplifying the code," so my expectation
is that Ada coding standards be pretty slim and simple.  However, that is
often not the case in many shops.  Why is this?  A lot of really smart guys
from all over the world debated how to design a language that was safe and
simplifies programming, so why are shops writing huge complex coding
standards to "simplify" Ada programming?  It's already simple!

Another "rule" similar to not using gotos is to not use early returns from
a subprogram, or not use an exit from a loop.  Why would you ban the use of
these constructs?  Computer scientists from all over the world decided that
these features were a good thing, or else they wouldn't have made it into
the language.  So I always need to ask a shop that prohibits them, What do
you know that they don't?  As if adding a flag to an already-complex loop
predicate is better than an exit!  What are these people thinking?  (A
question perhaps better phrased as, Why are these people not thinking?)

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  reply	other threads:[~1997-06-14  0:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-11  0:00 GOTO considered necessary (reworked) Samuel Mize
1997-06-11  0:00 ` Bryce Bardin
1997-06-12  0:00 ` Anonymous
1997-06-12  0:00   ` Robert Dewar
1997-06-12  0:00     ` John G. Volan
1997-06-13  0:00       ` Robert A Duff
1997-06-16  0:00         ` John G. Volan
1997-06-17  0:00           ` Robert A Duff
1997-06-25  0:00             ` Van Snyder
1997-06-17  0:00           ` Robert Dewar
1997-06-17  0:00             ` Robert A Duff
1997-06-18  0:00               ` Spam Hater
1997-06-20  0:00               ` Robert Dewar
1997-06-21  0:00                 ` Robert A Duff
1997-06-21  0:00                   ` Robert Dewar
1997-06-20  0:00               ` Robert Dewar
1997-06-25  0:00               ` Wolfgang Gellerich
1997-06-25  0:00                 ` Samuel T. Harris
1997-06-25  0:00                 ` Michael F Brenner
1997-06-26  0:00                   ` Wolfgang Gellerich
1997-06-19  0:00             ` Karel Th�nissen
1997-06-19  0:00               ` Karel Th�nissen
1997-06-23  0:00               ` John G. Volan
1997-06-23  0:00                 ` Robert Dewar
1997-06-24  0:00                   ` Brian Rogoff
1997-06-25  0:00                   ` Featuritis not always bad (was re: GOTO considered necessary) Karel Th�nissen
1997-06-26  0:00                     ` Robert Dewar
1997-06-26  0:00                       ` Karel Th�nissen
1997-06-23  0:00                 ` GOTO considered necessary (reworked) Spam Hater
1997-06-25  0:00                 ` Karel Th�nissen
1997-06-23  0:00             ` John G. Volan
1997-06-17  0:00           ` Robert I. Eachus
1997-07-21  0:00           ` Shmuel (Seymour J.) Metz
1997-06-12  0:00   ` John G. Volan
1997-06-16  0:00     ` Anonymous
1997-06-12  0:00 ` Michael F Brenner
1997-06-17  0:00   ` Robert Dewar
1997-06-17  0:00     ` Robert A Duff
1997-06-20  0:00       ` Robert Dewar
1997-06-21  0:00         ` Robert A Duff
1997-06-21  0:00           ` Robert Dewar
1997-06-13  0:00 ` Robert A Duff
1997-06-14  0:00   ` Robert Dewar
1997-06-16  0:00     ` Spam Hater
1997-06-17  0:00       ` Robert Dewar
1997-06-17  0:00         ` Spam Hater
1997-06-16  0:00     ` Robert A Duff
1997-06-17  0:00       ` Spam Hater
1997-06-17  0:00         ` Robert A Duff
1997-06-19  0:00           ` Spam Hater
1997-06-17  0:00         ` Robert Dewar
1997-06-17  0:00           ` Spam Hater
1997-06-17  0:00           ` Robert A Duff
1997-06-19  0:00             ` John Herro
1997-06-25  0:00               ` Function result Van Snyder
1997-06-27  0:00                 ` Robert Dewar
1997-06-27  0:00                 ` Jon S Anthony
1997-06-20  0:00             ` GOTO considered necessary (reworked) Robert Dewar
1997-06-14  0:00   ` Samuel Mize
1997-06-14  0:00   ` Samuel Mize
1997-06-14  0:00     ` Matthew Heaney [this message]
1997-06-16  0:00 ` Anonymous
1997-06-16  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox