comp.lang.ada
 help / color / mirror / Atom feed
From: linnig@ti.com (Mike linnig)
Subject: Re: Use of 'goto'
Date: 1997/06/20
Date: 1997-06-20T00:00:00+00:00	[thread overview]
Message-ID: <linnig-2006970752500001@news.ti.com> (raw)
In-Reply-To: 01bc7c39$64813260$LocalHost@xhv46.dial.pipex.com


In article <01bc7c39$64813260$LocalHost@xhv46.dial.pipex.com>, "Nick
Roberts" <Nick.Roberts@dial.pipex.com> wrote:

> 
> This is an extreme (and very rare) example. However, from years of
> (sometimes bitter) experience programming 'in the field' on real programs,
> I can put my hand on my heart and say that the humble goto comes in real
> handy every so often. It is sometimes by far the neatest way to do it; it
> is sometimes the only way to do it; it is sometimes the only way to replumb
> a piece of code in five minutes when you've only got five minutes (on the
> range, for example - boy could I tell some stories).

Well after having been involved in a rewrite of our Ada coding standards
I've come to the conclusion that people concentrate on things that are
easy to detect.   It is  easy to detect the use of goto, it is quite
visible, you can grep for it.   

Spagetti code is bad, spagetti code uses gotos, therefore goto is bad.  
Lots of things are bad in Ada.  Global variables run amok is bad.  
Confusing variable name are bad.   It is not always possible to define
what is bad in a way that a non-programmer observer can detect it (SQE's,
the boss).

I think training is a better way to make good code than arbitrary restrictions
on easy to notice features.    In most environments, peer pressure will cause
folks to move away from bad constructs if everyone has similar ideas on
what is bad.

Having said all that, our standards still restrict GOTO's, but we put in an
escape clause that says that the team lead can override the standards if
it is required.   This raises the visibilty to the person responsible for
getting the job done and 'teaches' the programmer that goto's are a construct
that should not be used lightly.

Regards,

   Mike Linnig


+-----------------------------------------+
| Mike Linnig                             |
| Phone: (972) 927-3469                   |
+-----------------------------------------+




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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-18  0:00 Use of 'goto' Nick Roberts
1997-06-20  0:00 ` Mike linnig [this message]
1997-06-20  0:00   ` Robert Dewar
1997-07-03  0:00   ` Shmuel (Seymour J.) Metz
1997-07-03  0:00     ` Robert Dewar
1997-07-03  0:00 ` Shmuel (Seymour J.) Metz
replies disabled

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