comp.lang.ada
 help / color / mirror / Atom feed
From: "Mark L. Fussell" <mark.fussell@chimu.com>
To: Jon S Anthony <jsa@alexandria.organon.com>
Subject: Re: Building blocks (Was: Design By Contract)
Date: 1997/09/23
Date: 1997-09-23T00:00:00+00:00	[thread overview]
Message-ID: <3427B839.6FB5@chimu.com> (raw)
In-Reply-To: JSA.97Sep19164111@alexandria.organon.com


Jon S Anthony wrote:
...
> Is the Eiffel approach really conceptually different from a recursive
> "retry" (where the Eiffel retry is basically a structured goto the
> beginning of the current invocation)?  For example,
> 
> procedure P (.... Attempts : Natural := 0) is
> ...
>     if Attempts = 0 then
>         -- do main stuff
>     else
>         -- do nothing
>     end;
> exception
>     when others => -- (or more specific exception...)
>         P(....Attempts+1)
>         ...
> end P;

I agree that this is pretty similar to my/OOSC-2s example.  The obvious
difference is you have publicly exposed the 'attempts' variable which is
an implementation detail, but of course this could be hidden through a
second, private procedure/feature that is delegated to.  And the general
case could have 0..N state variables passed back in.
   The more important [IMO] difference is the 'feel' again.  The above
code shows the flexibility in exception handling that Eiffel consciously
chose to disallow: having anything other than the current invocation's
main body 'continue' from an exception.  So the above code functions
almost identically to the Eiffel code but it implies the possibility of
a different solution (different responsibility) which Eiffel never
would.  Whether you view this as a guiding hand or hand-cuffs is
probably very subjective.  I doubt there is any empirical evidence that
this particular Eiffel restriction produces better software[1], but it
obviously does fit in well with Eiffel as a whole as it came from the
same mind.

--Mark
mark.fussell@chimu.com

[1] In my previous post I guessed at what it might help with: returning
you to thinking about how to satisfy the routine call after you recover
from the exception itself.  You certainly have to jump through an extra
hoop to carelessly ignore an exception: you don't have the
Java/C++/standard short-circuit construct:
    try {
        ...
    } catch (Exception e) {};
But as multiple people have noted, there is a time for everything, and
the above construct can be useful, for example, if you have a valid
state before the 'try' and nothing within the 'try' will invalidate it
(i.e. it will only move to another valid state or not at all).
   So we always return to the same meta-question: when should
programmers be free but disciplined and when should they be confined? 
What tradeoffs are appropriate in each context?  Hmmm... should be a
'Pattern' for this somewhere out there.

  i   ChiMu Corporation      Architectures for Information
 h M   info@chimu.com         Object-Oriented Information Systems
C   u    www.chimu.com         Architecture, Frameworks, and Mentoring




  reply	other threads:[~1997-09-23  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   ` Robert Dewar
1997-09-18  0:00   ` Jon S Anthony
1997-09-18  0:00   ` Stephen Leake
1997-09-18  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             ` 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             ` Joachim Durchholz
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                   ` Joachim Durchholz
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
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-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-19  0:00       ` Jon S Anthony
1997-09-23  0:00         ` Mark L. Fussell [this message]
1997-09-18  0:00     ` W. Wesley Groleau x4923
1997-09-21  0:00       ` Matthew Heaney
  -- 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           ` W. Wesley Groleau x4923
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-15  0:00                   ` John G. Volan
1997-09-14  0:00                 ` Robert Dewar
1997-09-14  0:00                 ` Robert Dewar
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00             ` Jon S Anthony
replies disabled

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