comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Interface/Implementation (was Re: Design by Contract)
Date: 1997/08/28
Date: 1997-08-28T00:00:00+00:00	[thread overview]
Message-ID: <EFMpCv.8uv.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 01bcb389$24f579d0$1c10d30a@ntwneil


Neil Wilson (nobody@nobody.com) wrote:

: Tucker Taft <stt@houdini.camb.inmet.com> wrote in article
: <EFLp4n.HJC.0.-s@inmet.camb.inmet.com>...
: > In my experience, separating the spec and body physically is
: > extremely advantageous, and the need to have redundancy between
: > the spec and body is an important feature in a multi-person
: > project, not an "inconvenience."  In Ada (and to some extent in C/C++

: Then do it. This is what fully deferred (or even partially deferred)
: classes do in Eiffel. You can even lock down the specification by providing
: only the Precompiled version to your implementors (or more simply lock out
: the deferred class file using file permissions).

One can always argue both sides of an issue like this.  

   1) Our language forces you to separate spec and body, and
      that is good.

   2) Our language allows you to separate spec and body, but
      doesn't force you to, so that is good.

Perhaps a more relevant question is what style "real" programmers
adopt when they use the language, and how this affects the
productivity, maintainability, readability, etc., of code
built in that language.

Note that the Eiffel folks argue exactly the opposite when they
talk about "purity" of OO languages, saying that Eiffel *forces*
you to put everything in a class, and that is good, whereas the
Ada folks say that Ada *allows* you to only use tagged types,
but doesn't force you to, so that is good.

Similarly, Eiffel forces you to only have exception handlers
at the top-level of an operation (which never seemed "good"
to me, but perhaps because I don't understand the full argument
in favor of this requirement), whereas Ada allows you to place
exception handlers as locally or globally as appropriate.

In general, language designers have to choose carefully between
where they "force" something on the programmer, and where they
simply support something.  Furthermore, when more than one approach
is supported, they have to choose whether one is made significantly
easier or more convenient than the other.  This is because the 
rules of the language have a subtle effect on the style adopted by 
the programmers.  It is certainly not zero effect, but it of course 
is not overwhelming, in that design approaches, past history, etc., 
all have an effect as well.

However, as far as separation of spec and body, I believe many
people who have used Ada over the past 15 years believe that this
separation "enforced" by Ada was perhaps its most fundamental
contribution to programming style.  Given that belief, it is very 
surprising (at least to me) to see some languages moving away from this
separation, and only "allowing" it (and sometimes requiring you to
work a bit harder and restructure a bit to do it).  

It is possible that the time for "forcing" this separation is past, but 
based on my recent use of Java in a multi-person project, I don't
think so.  The Java "interface" type and "abstract" classes are nice, 
but the fact that spec and body are merged in most Java classes,
even given tools like "javap" and "javadoc" to extract the interface, doesn't
substitute for separate spec and body.  

The hand-written Ada package spec (or even C header) remains a far 
superior interface document for a given abstraction than is anything 
I have seen extracted by a tool.  The result of extraction by a tool 
typically ends up getting some but not all of the comments, and the 
various operations are not presented in necessarily a helpful order, 
or with any useful higher-level organization.

Basically, the extraction tool tends to tell you what an abstraction
"is" or "does", rather than what it is supposed to do, and why.
When trying to decide whether a given implementation is correct, 
without that separate human-written spec, it is much harder to evaluate.
One is simply stuck trying to evaluate internal consistency, rather
than consistency against a separate human-written spec.  

As an example, look at the "javadoc" produced for the Java 
standard API.  It gives you the facts, but almost nothing more.  
I suspect that if someone had been "forced" to write a 
separate spec for each of these classes, there would be something 
more "specification"-ish there (i.e. what the routines are 
supposed to do, in words).

: Neil Wilson (neil at aldur dot demon dot co dot uk)
: Aldur Systems Ltd, UK 

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




       reply	other threads:[~1997-08-28  0:00 UTC|newest]

Thread overview: 185+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <01bcb389$24f579d0$1c10d30a@ntwneil>
1997-08-28  0:00 ` Tucker Taft [this message]
1997-08-29  0:00   ` Interface/Implementation (was Re: Design by Contract) Paul Johnson
1997-08-29  0:00     ` Jon S Anthony
     [not found]       ` <EFqDC8.342@ecf.toronto.edu>
1997-09-02  0:00         ` Samuel Mize
1997-09-03  0:00           ` Paul Johnson
1997-09-03  0:00           ` Patrick Doyle
1997-09-03  0:00             ` Samuel Mize
1997-09-04  0:00           ` Erik Ernst
     [not found]           ` <EFyrH2.7z2@syd.csa.com.au>
1997-09-04  0:00             ` Joerg Rodemann
1997-09-05  0:00               ` Don Harrison
     [not found]                 ` <340fdb9f.0@news.uni-ulm.de>
1997-09-06  0:00                   ` Joachim Durchholz
1997-09-06  0:00               ` Joachim Durchholz
1997-09-04  0:00             ` W. Wesley Groleau x4923
1997-09-05  0:00               ` Don Harrison
1997-09-05  0:00                 ` Jon S Anthony
1997-09-06  0:00                   ` Fergus Henderson
1997-09-06  0:00                     ` Jon S Anthony
1997-09-05  0:00                 ` W. Wesley Groleau x4923
1997-09-06  0:00                   ` Joachim Durchholz
1997-09-09  0:00                   ` Robert Dewar
1997-09-09  0:00                     ` Richard Kenner
1997-09-10  0:00                     ` Tucker Taft
1997-09-10  0:00                       ` Joachim Durchholz
1997-09-10  0:00                       ` One pass compilation? W. Wesley Groleau x4923
1997-09-10  0:00                       ` Interface/Implementation (was Re: Design by Contract) Nick Leaton
1997-09-10  0:00                         ` W. Wesley Groleau x4923
1997-09-11  0:00                         ` Code ordering Steve Furlong
1997-09-12  0:00                         ` Interface/Implementation (was Re: Design by Contract) Robert Dewar
1997-09-12  0:00                           ` Nick Leaton
1997-09-11  0:00                       ` Robert Dewar
1997-09-08  0:00                 ` Robert Dewar
1997-09-11  0:00                   ` Don Harrison
1997-09-08  0:00                 ` Robert Dewar
1997-09-11  0:00                   ` Don Harrison
1997-09-12  0:00                     ` Robert Dewar
1997-09-05  0:00               ` Jon S Anthony
1997-09-06  0:00                 ` Patrick Doyle
1997-09-06  0:00                   ` Jon S Anthony
1997-09-05  0:00               ` Patrick Doyle
1997-09-05  0:00                 ` W. Wesley Groleau x4923
1997-09-06  0:00                   ` Patrick Doyle
1997-09-05  0:00             ` Matthew Heaney
1997-09-06  0:00               ` Joachim Durchholz
1997-09-06  0:00               ` Patrick Doyle
1997-09-06  0:00                 ` Matthew Heaney
1997-09-07  0:00                   ` Patrick Doyle
1997-09-07  0:00                     ` Matthew Heaney
1997-09-10  0:00                       ` Don Harrison
1997-09-10  0:00                         ` Tucker Taft
1997-09-10  0:00                           ` Matthew Heaney
1997-09-10  0:00                             ` Patrick Doyle
1997-09-12  0:00                               ` Robert Dewar
1997-09-13  0:00                                 ` Patrick Doyle
1997-09-11  0:00                             ` Lee Webber
1997-09-15  0:00                               ` W. Wesley Groleau x4923
1997-09-12  0:00                             ` Don Harrison
1997-09-10  0:00                           ` Don Harrison
1997-09-12  0:00                             ` Robert Dewar
1997-09-16  0:00                               ` Don Harrison
1997-09-17  0:00                                 ` Robert Dewar
1997-09-10  0:00                         ` Patrick Doyle
1997-09-16  0:00                           ` Don Harrison
1997-09-18  0:00                             ` Robert Dewar
1997-09-18  0:00                               ` Shmuel (Seymour J.) Metz
1997-09-20  0:00                                 ` Robert Dewar
1997-09-10  0:00                         ` Samuel Mize
1997-09-10  0:00                           ` Samuel Mize
1997-09-11  0:00                           ` Robert Dewar
1997-09-12  0:00                             ` Samuel Mize
1997-09-13  0:00                               ` Tucker Taft
1997-09-12  0:00                             ` Samuel T. Harris
1997-09-17  0:00                             ` Don Harrison
1997-09-18  0:00                               ` Robert Dewar
1997-09-11  0:00                           ` Don Harrison
1997-09-10  0:00                         ` Matthew Heaney
1997-09-11  0:00                         ` Robert Dewar
1997-09-10  0:00                     ` Robert Dewar
1997-09-10  0:00                       ` Nick Leaton
1997-09-16  0:00                       ` Frederic Guerin
1997-09-06  0:00                 ` Matthew Heaney
1997-09-06  0:00               ` Matt Kennel (Remove 'NOSPAM' to reply)
1997-09-06  0:00                 ` Jon S Anthony
1997-09-08  0:00               ` John G. Volan
1997-09-09  0:00                 ` Paul Johnson
1997-09-09  0:00                 ` Nick Leaton
1997-09-09  0:00                   ` John G. Volan
1997-09-10  0:00                     ` Nick Leaton
1997-09-10  0:00                       ` Samuel Mize
     [not found]               ` <dewar.873826570@merv>
1997-09-09  0:00                 ` Matthew Heaney
1997-09-11  0:00                   ` Robert Dewar
1997-09-07  0:00             ` Robert Dewar
1997-09-08  0:00               ` Patrick Doyle
1997-09-09  0:00               ` Don Harrison
1997-09-09  0:00                 ` W. Wesley Groleau x4923
1997-09-10  0:00                 ` Robert Dewar
1997-09-11  0:00                   ` Don Harrison
1997-09-12  0:00                     ` Robert Dewar
1997-09-16  0:00                       ` Don Harrison
1997-09-17  0:00                         ` Robert Dewar
1997-09-05  0:00           ` Robert Dewar
1997-09-01  0:00   ` Matt Kennel (Remove 'NOSPAM' to reply)
1997-09-02  0:00     ` Nick Leaton
1997-09-03  0:00       ` Matt Kennel (Remove 'NOSPAM' to reply)
1997-09-15  0:00 Marc Wachowitz
1997-09-16  0:00 ` Owen Fellows
  -- strict thread matches above, loose matches on Subject: below --
1997-09-12  0:00 Marc Wachowitz
1997-09-12  0:00 ` Samuel T. Harris
1997-09-12  0:00   ` Jon S Anthony
1997-09-15  0:00     ` Samuel T. Harris
1997-09-16  0:00       ` Jon S Anthony
1997-09-12  0:00 ` Joachim Durchholz
1997-09-09  0:00 Marc Wachowitz
1997-09-15  0:00 ` Owen Fellows
1997-10-13  0:00   ` Bill Foote
1997-09-06  0:00 Ell
1997-09-06  0:00 ` Samuel Mize
     [not found] <EForKz.FJ7@ecf.toronto.edu>
1997-09-01  0:00 ` Don Harrison
1997-09-02  0:00   ` Don Harrison
1997-08-07  0:00 Safety-critical development in Ada and Eiffel Ken Garlington
1997-08-12  0:00 ` Don Harrison
1997-08-25  0:00   ` Design by Contract Bertrand Meyer
     [not found]     ` <3402d123.0@news.uni-ulm.de>
1997-08-26  0:00       ` Nick Leaton
     [not found]         ` <3402e51d.0@news.uni-ulm.de>
     [not found]           ` <3402E8C9.3384D976@calfp.co.uk>
     [not found]             ` <dewar.872631036@merv>
     [not found]               ` <3403F668.F6B57D97@calfp.co.uk>
     [not found]                 ` <34041331.0@news.uni-ulm.de>
     [not found]                   ` <3404696D.4487EB71@eiffel.com>
1997-08-27  0:00                     ` Interface/Implementation (was Re: Design by Contract) Bertrand Meyer
     [not found]                       ` <34048FDC.13728473@eiffel.com>
1997-08-27  0:00                         ` Bertrand Meyer
1997-08-28  0:00                           ` Jon S Anthony
1997-08-29  0:00                             ` Robert Dewar
     [not found]                             ` <EForsv.Fqo@ecf.toronto.edu>
     [not found]                               ` <JSA.97Aug29191413@alexandria.organon.com>
     [not found]                                 ` <EFqDAG.2zn@ecf.toronto.edu>
1997-08-30  0:00                                   ` Jon S Anthony
1997-09-02  0:00                                   ` Don Harrison
1997-09-02  0:00                                     ` Jon S Anthony
1997-09-03  0:00                                       ` Don Harrison
     [not found]                                     ` <EFwuzD.BxE@ecf.toronto.edu>
1997-09-04  0:00                                       ` John G. Volan
1997-09-04  0:00                                         ` W. Wesley Groleau x4923
1997-09-05  0:00                                           ` Patrick Doyle
1997-09-05  0:00                                             ` W. Wesley Groleau x4923
1997-09-06  0:00                                               ` Patrick Doyle
1997-09-08  0:00                                               ` Paul Johnson
1997-09-06  0:00                                             ` Jon S Anthony
1997-09-08  0:00                                           ` Robert Dewar
1997-09-09  0:00                                             ` Patrick Doyle
1997-09-09  0:00                                               ` Matthew Heaney
1997-09-10  0:00                                                 ` Patrick Doyle
1997-09-09  0:00                                             ` Robert S. White
1997-09-09  0:00                                             ` Paul Johnson
1997-09-11  0:00                                               ` Robert Dewar
1997-09-11  0:00                                                 ` Veli-Pekka Nousiainen
1997-09-12  0:00                                                 ` Paul Johnson
1997-09-14  0:00                                                   ` Ken Garlington
1997-09-09  0:00                                           ` Matt Kennel (Remove 'NOSPAM' to reply)
1997-09-10  0:00                                             ` John Viega
1997-09-10  0:00                                               ` Matt Kennel (Remove 'NOSPAM' to reply)
1997-09-05  0:00                                         ` Franck Arnaud
1997-09-05  0:00                                         ` Patrick Doyle
1997-09-04  0:00                                       ` Don Harrison
1997-09-05  0:00                                         ` Patrick Doyle
1997-09-09  0:00                                           ` Don Harrison
1997-09-09  0:00                                             ` W. Wesley Groleau x4923
1997-09-10  0:00                                               ` Veli-Pekka Nousiainen
1997-09-10  0:00                                                 ` Samuel Mize
1997-09-12  0:00                                               ` Don Harrison
1997-09-10  0:00                                             ` Patrick Doyle
1997-09-10  0:00                                               ` Joerg Rodemann
1997-09-10  0:00                                                 ` Joachim Durchholz
1997-09-12  0:00                                                   ` Joerg Rodemann
1997-09-10  0:00                                                 ` Patrick Doyle
1997-09-11  0:00                                                   ` Matt Austern
1997-09-12  0:00                                                     ` Jon S Anthony
1997-09-13  0:00                                                     ` Patrick Doyle
1997-09-11  0:00                                               ` Robert S. White
1997-09-11  0:00                                                 ` Don Harrison
1997-09-12  0:00                                                 ` Robert Dewar
1997-09-13  0:00                                                 ` Patrick Doyle
1997-09-12  0:00                                               ` Jon S Anthony
1997-09-13  0:00                                                 ` Patrick Doyle
1997-09-16  0:00                                                   ` Brian Rogoff
1997-08-28  0:00                           ` Patrick Doyle
1997-08-28  0:00                             ` W. Wesley Groleau x4923
1997-08-28  0:00                       ` Tucker Taft
1997-08-28  0:00                         ` W. Wesley Groleau x4923
1997-08-28  0:00                           ` Jon S Anthony
     [not found]                             ` <EFnK8D.Lsv@ecf.toronto.edu>
1997-08-29  0:00                               ` Jon S Anthony
1997-08-30  0:00                                 ` Patrick Doyle
1997-08-30  0:00                                   ` Jon S Anthony
1997-09-01  0:00                                     ` Patrick Doyle
1997-08-29  0:00                             ` Suzanne Zampella
1997-08-29  0:00                               ` Jon S Anthony
     [not found]                             ` <340E9BA2.32B3@rbgg252.rbg1.siemens.de>
1997-09-07  0:00                               ` Robert Dewar
     [not found]                         ` <3406A707.787D@dmu.ac.uk>
1997-08-29  0:00                           ` Joerg Rodemann
1997-08-29  0:00                             ` Ralph Paul
1997-09-01  0:00                           ` Don Harrison
replies disabled

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