comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Avoiding side effects
Date: Mon, 13 Oct 2008 14:22:08 -0700 (PDT)
Date: 2008-10-13T14:22:08-07:00	[thread overview]
Message-ID: <d3ea88f3-cb6c-48a2-9661-5cd63fdbf188@l33g2000pri.googlegroups.com> (raw)
In-Reply-To: C51956DF.FC7C2%yaldnif.w@blueyonder.co.uk

On Oct 13, 11:49 am, "(see below)" <yaldni...@blueyonder.co.uk> wrote:

> That's just one of many, along with: "never use goto", "never use
> exceptions", "never use 'use' clauses", "never use pointers", "the OO
> approach is always right", "the market is always right", etc, etc, etc.

[snip]

> What is silly is tying yourself in knots to avoid a perfectly sensible way
> of doing something, because it is abominated by the adherents of a dogma.
>
> The trouble is that bright people (Dijkstra, Hoare, Dahl, etc) offer
> recommendations for general approaches, to be applied with common sense; but
> then their much dimmer followers turn the recommendations into religions.

Or even worse... they turn it into department policy.

It seems like I've seen too many indicences on comp.lang.ada where a
poster wasn't allowed to use a particular construct, even if it was
the best one for their particular situation, because of a department
policy not to use <whatever>.

I've fallen victim to the religion thing, though; when Dijkstra's
"Gotos considered harmful" article came out, I was a COBOL programmer
for the school district at the time, and most of the existing programs
was truly abominably-written spaghetti code, and probably so were most
of mine at the time.  But I (**** SAW THE LIGHT ****) and started
avoiding GOTO's like the plague, which was quite difficult because
COBOL at the time did not have decent control structures---no loops,
just PERFORM paragraph UNTIL, and no "if...end if" or "begin...end"
constructs so that IF's couldn't always be nested inside other IF's
with generality, so I was doing things like moving code sequences down
to separate paragraphs so that I could PERFORM them.  I guess it did
make my code better than spaghetti, but it was still pretty contorted,
and it took some time and a Yourdon book to realize that was I was
doing was silly and unproductive, and started using GOTOs in a more
sensible manner.  I wouldn't say I was particularly "dim" at the time,
just inexperienced, perhaps not surprising since I was only about
sixteen at the time.

But you're absolutely right.  The most important thing is to learn
what makes a program readable and maintainable.  Sometimes this just
takes experience.  But no matter what, dogmas are a very poor
substitute for this kind of learning and experience.  With a few
exceptions... I still think "don't ever use ALTER statements" is
probably a good dogma for COBOL programmers.  The spaghetti-code
programmers who wrote the old software loved using them, and they
always made code difficult to follow.  So I guess even the "no dogmas"
dogma is the kind of dogma that should be avoided...

                              -- Adam



  reply	other threads:[~2008-10-13 21:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30  5:50 Avoiding side effects Anders Wirzenius
2008-09-30  7:48 ` Jean-Pierre Rosen
2008-09-30  9:20   ` Anders Wirzenius
2008-09-30 11:36     ` Jean-Pierre Rosen
2008-09-30 12:43       ` Anders Wirzenius
2008-09-30 10:42 ` Ludovic Brenta
2008-09-30 11:12   ` Anders Wirzenius
2008-10-02 12:56 ` Ole-Hjalmar Kristensen
2008-10-06 12:09   ` Anders Wirzenius
2008-10-07 11:08     ` Ole-Hjalmar Kristensen
2008-10-07 14:24       ` (see below)
2008-10-07 14:47         ` Anders Wirzenius
2008-10-07 14:51           ` (see below)
2008-10-08  5:16             ` Anders Wirzenius
2008-10-08  7:35               ` Dmitry A. Kazakov
2008-10-08 15:32               ` (see below)
2008-10-13 12:27                 ` Anders Wirzenius
2008-10-13 13:21                   ` Marco
2008-10-13 18:55                     ` (see below)
2008-10-14  7:30                       ` Dmitry A. Kazakov
2008-10-14 11:44                         ` Colin Paul Gloster
2008-10-13 18:49                   ` (see below)
2008-10-13 21:22                     ` Adam Beneschan [this message]
2008-10-13 21:53                       ` (see below)
2008-10-14  6:17                         ` mockturtle
2008-10-14 14:58                           ` Adam Beneschan
2008-10-14  6:22                     ` Avoiding side effects and other dogma Anders Wirzenius
2008-10-14 13:48                       ` (see below)
replies disabled

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