comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Johnson <Paul@treetop.demon.co.uk>
Subject: Re: Building blocks (Was: Design By Contract)
Date: 1997/10/15
Date: 1997-10-15T00:00:00+00:00	[thread overview]
Message-ID: <5w3FnzA6KRR0Iwt+@treetop.demon.co.uk> (raw)
In-Reply-To: mheaney-ya023680000410970119430001@news.ni.net


In article <mheaney-ya023680000410970119430001@news.ni.net>, Matthew
Heaney <mheaney@ni.net> writes

>In article <PdRYMWAQ1cN0Iw4X@treetop.demon.co.uk>, Paul Johnson
><Paul@treetop.demon.co.uk> wrote:

>>I know that this was an aside, but it still puzzles me.  Surely it will
>>be wrong if the file is empty: there will be no record to read.  The
>>correct version (in Eiffel) would be
>>
>>   from file.open("foo") until file.eof loop
>>      thing.accept (file.record)
>>   end -- loop

[...]

>I think the original example, though, was this: read some numbers from the
>user interactively, process each one at a time, and stop processing when
>the user enters a zero.  In Ada, it would be 

[...]

>A while loop is more complex and error prone solution for this type of
>problem.  Soloway showed that there was a statistically significant
>difference between two populations, one using a test-at-the-top, and the
>other using a test-in-the-middle, with the latter group having fewer
>errors.  The reference is:
>
>Coginitive Strategies and Looping Constructs: An Empirical Study
>Elliot Soloway et al
>CACM, Vol. 26, No. 11, Nov 83, p. 853 - 860

[Examples of when you want to do this in real life deleted.]

Hmm.  Interesting.

I agree that the repeated read (or whatever instruction) before the loop
and at the end is a bad idea.  Quite apart from the Soloway experiment,
it is duplicating code.

OTOH I wonder if the situation might be reversed in real life situations
with deeply nested structures.  I'm rather dubious of small, neat coding
experiments such as Soloway's.  While they are the best handle we have
on the facts, I worry that in an attempt to come up with a controllable,
repeatable, and above all feasible experiment, they abstract out too
much complexity.  After all, it is complexity that makes programming
difficult.

I recall the great AT&T telephone crash in the late 80s (87?).  It was
caused by a bug where a programmer had mistaken the scope of a "break"
instruction, and hence miscalculated the target of the resulting jump.
Now thats not a statistical experiment, but its a worrying data point.
I wonder what would happen if Soloway's experiment were repeated with
more complex problems involving nested loops.

(I haven't actually read the paper, but I'll see if our library has it
tomorrow).

Paul.

--------------------------------+---------------------------------
Paul Johnson                    | You are lost in a maze of twisty
Email: Paul@treetop.demon.co.uk | little standards, all different.
       paul.johnson@gecm.com    |




  reply	other threads:[~1997-10-15  0:00 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  0:00 Building blocks (Was: Design By Contract) Marc Wachowitz
1997-09-15  0:00 ` Joachim Durchholz
1997-09-17  0:00 ` Paul Johnson
1997-09-18  0:00   ` Stephen Leake
1997-09-18  0:00     ` W. Wesley Groleau x4923
1997-09-21  0:00       ` Matthew Heaney
1997-09-18  0:00     ` Mark L. Fussell
1997-09-19  0:00       ` Jon S Anthony
1997-09-23  0:00         ` Mark L. Fussell
     [not found]       ` <11861963wnr@eiffel.demon.co.uk>
1997-09-19  0:00         ` Mark L. Fussell
1997-09-19  0:00       ` Robert A Duff
1997-09-20  0:00         ` Joachim Durchholz
1997-09-22  0:00           ` Matthew Heaney
1997-09-23  0:00             ` Joachim Durchholz
1997-09-23  0:00             ` Veli-Pekka Nousiainen
1997-10-03  0:00               ` Robert I. Eachus
1997-10-04  0:00                 ` Paul Johnson
1997-10-14  0:00                   ` Robert I. Eachus
1997-09-23  0:00           ` Jon S Anthony
1997-09-24  0:00           ` Richard A. O'Keefe
1997-09-24  0:00           ` Alan E & Carmel J Brain
1997-09-25  0:00             ` Anonymous
1997-09-30  0:00               ` Alan E & Carmel J Brain
1997-09-30  0:00                 ` Matthew Heaney
1997-09-30  0:00                   ` Neil Wilson
1997-09-30  0:00                     ` Stephen Leake
1997-09-30  0:00                   ` W. Wesley Groleau x4923
1997-09-30  0:00                     ` Matthew Heaney
1997-10-01  0:00                     ` Alan E & Carmel J Brain
1997-10-01  0:00                 ` Anonymous
1997-10-01  0:00                   ` Paul M Gover
1997-10-04  0:00                     ` Paul Johnson
1997-10-04  0:00                       ` Matthew Heaney
1997-10-15  0:00                         ` Paul Johnson [this message]
1997-10-15  0:00                           ` Matthew Heaney
1997-10-16  0:00                             ` Joachim Durchholz
1997-10-17  0:00                               ` Robert I. Eachus
1997-10-16  0:00                           ` Joachim Durchholz
1997-10-22  0:00                           ` Reimer Behrends
1997-10-01  0:00                   ` Joachim Durchholz
1997-10-02  0:00                   ` Robert A Duff
1997-10-02  0:00                     ` Tucker Taft
1997-10-02  0:00                       ` Matthew Heaney
1997-10-03  0:00                     ` Stephen Leake
1997-10-04  0:00                     ` Matthew Heaney
1997-10-07  0:00                       ` Robert A Duff
1997-09-18  0:00   ` Jon S Anthony
1997-09-18  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-09-11  0:00 Robert Dewar
1997-09-09  0:00 Marc Wachowitz
1997-09-02  0:00 Design By Contract Jon S Anthony
     [not found] ` <JSA.97Sep3201329@alexandria.organon.com>
1997-09-04  0:00   ` Paul Johnson
     [not found]     ` <5un58u$9ih$1@gonzo.sun3.iaf.nl>
1997-09-06  0:00       ` Building blocks (Was: Design By Contract) Joachim Durchholz
1997-09-08  0:00       ` Paul Johnson
1997-09-08  0:00         ` Brian Rogoff
1997-09-09  0:00           ` Matthew Heaney
1997-09-09  0:00             ` W. Wesley Groleau x4923
1997-09-10  0:00               ` Robert A Duff
1997-09-12  0:00                 ` Jon S Anthony
1997-09-09  0:00             ` Brian Rogoff
1997-09-10  0:00             ` Paul Johnson
1997-09-10  0:00               ` Darren New
1997-09-10  0:00               ` Matthew Heaney
1997-09-10  0:00             ` Robert Dewar
1997-09-12  0:00               ` Jon S Anthony
1997-09-12  0:00                 ` Robert Dewar
1997-09-16  0:00                   ` Brian Rogoff
1997-09-12  0:00               ` Paul Johnson
1997-09-14  0:00                 ` Robert Dewar
1997-09-14  0:00                 ` Robert Dewar
1997-09-15  0:00                   ` John G. Volan
1997-09-14  0:00                 ` Robert Dewar
1997-09-09  0:00           ` W. Wesley Groleau x4923
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00             ` Jon S Anthony
1997-09-09  0:00           ` Veli-Pekka Nousiainen
replies disabled

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