comp.lang.ada
 help / color / mirror / Atom feed
From: Owen Fellows <ofellows@calfp.co.uk>
Subject: Re: Interface/Implementation (was Re: Design by Contract)
Date: 1997/09/16
Date: 1997-09-16T00:00:00+00:00	[thread overview]
Message-ID: <341E4679.4BE4100E@calfp.co.uk> (raw)
In-Reply-To: 5vkfb2$f2p$2@trumpet.uni-mannheim.de



Marc Wachowitz wrote:
> 
> Nick <nickle@calfp.co.uk> wrote via Owen Fellows <ofellows@calfp.co.uk>
> about supposedly "pure" OO a la Eiffel vs. Ada-like modules and types as
> different concepts and non-method procedures:
> > But it it more likely that you just inherit MATHEMATICIAN somewhere in
> > your heirarchy to save on typing.
> 
> I find that totally unacceptable, as it creates much too strong coupling
> between library modules and their clients. Adding new features to a library
> module shouldn't force even the smallest change in any previously existing
> clients. The same applies to unavoidable visibility of every parent feature
> in children - to avoid potential clashes, one is forced to revert to using
> long_feature_names_saying_they_are_only_for_class_X_and_not_for_children,
> which is a shame for a somewhat recent language like Eiffel (even in old
> K&R C you had private - aka static - functions/variables), in my view. 

Well, in practice I haven't found this to be a problem at all. This is
in a 800,000 line
project. Lots of names are the same in different classes, like the use
of
consistent names in the standard libraries (extend, remove etc ...)
This is a strong indication that such name clashes if they happen, are
rare events.

Visibility in all children. This can be an issue but not as much as you
think. 
It is usually indicative of having an implementation at the high level
of a heirarchy
and you should, in my opinion, use facility inheritance lower down where
necessary.
Now other Eiffel programmers would disagree with me, and use facility
inheritance at
the top of the heirarchy, as there is less typing.

> The
> point isn't so much about children touching conceptually private features
> of parents where they shouldn't do that (though that does get "interesting"
> in large projects with say, 50 to 100 programmers of varying quality, and
> I'd rather have that checked, too), but about clean separation of concerns
> and minimal coupling.

Minimal coupling is important. But from practical experience, classes we
have
written that are used for facility inheritance tend to be very stable,
don't
have name changes (implementation varies), and are usually only
extended.
Think about the MATHEMATICIAN for an example. The clashes don't happen
any
where near the level that one may presume they would happen if you
haven't
written systems in practice.

> > Having the same implementation as inherits is a hint that it probably is
> > inherits!
> 
> No more than the implementation of loops via conditional goto is a hint to
> drop explicit loops from the language and only provide conditional goto (and
> perhaps call/return) as control structure. I expect most people wouldn't
> follow the latter reasoning (nor do I), and likewise I disagree with your
> above suggestion. In fact, I'd already use inheritance much less than what
> seems to be usual in the Eiffel world (if Bertrand Meyer's books are a hint
> about general usage): Even if it means more writing, I prefer having a mere
> client for an object via a field over implementation inheritance: As long as
> the representation type can be used unchanged via its abstract interface,
> I'll do so. If it's mostly right, but still no proper "is-a" relation holds,

Agreed, there is no is-a relationship! But is is-a the only valid use or 
description of inheritance. Read the chapter in OOSC II on the taxonomy
of
inheritance. BM writes better and clearer than I do.

> I'll also seriously consider a different subclass with some small changes
> for the different need, and then using this adaption as client in that new
> type which really isn't a proper subtype. I find this to be much better at
> decoupling, more explicit about the essential relations between those types,
> and more readable for my taste. The counter-argument about inefficiency due
> to another indirection doesn't hold, as the above is only about source level
> stuff: If performance is critical, make the compiler sufficiently clever to
> inline the respective data and operations for such cases, which should be
> quite trivial. The counter-argument about needing all the facilities which
> are used for inheritance again for import doesn't really work either, since
> the usage of library modules with qualified names for feature access doesn't
> need things like renaming, redefinition, re-export or hiding; simply write
> e.g. Math.Sin(X) and stop worrying about name space pollution. (Well, you
> do have to think about module names, which should ideally be a hierarchical
> name space, similar to Ada child packages or Java packages, but it reduces
> the amount of relevant names dramatically.)

Which is always an choice that you can make as an programmer, you are
not
forced to use the inheritance for facility inheritance, you can always
do this

feature {NONE}  -- Don't allow clients access

	Math: expanded MATHEMATICIAN -- A valid use of expanded

or


feature {NONE}  -- Don't allow clients access

	Math: MATHEMATICIAN is
	   once
              !!Result.make
           end

If MATHEMATICIAN requires some form of initialisation. 
You don't pollute name space then. Eiffel gives you the choice.

At the end of the day, with things like loops, you want to have
loops because it makes reading the code easier. The code ends up closer
to the logical view of the world, not its phsical implementation.

This was the major argument in my book for the implementation of
'precursor'.
Why should you be telling the compiler how to implement something using
double inheritance, when the compiler can do it for you, and the results
are more readable.

Now in the case of facility inheritance. You don't have to use that
method,
you can get exactly what you want (see above) meeting your criteria for
visibility and name spaces. Therefor, I don't think you need extend the 
language.

I would say that 8 months ago I had the same opinions as you have
expressed,
but I've changed my mind.

Nick (From Owen's account)




  reply	other threads:[~1997-09-16  0:00 UTC|newest]

Thread overview: 185+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-15  0:00 Interface/Implementation (was Re: Design by Contract) Marc Wachowitz
1997-09-16  0:00 ` Owen Fellows [this message]
1997-09-16  0:00 ` Libraries in pure OO [was Interface/Implementation (was Re: Design by Contract)] Graham Perkins
1997-09-17  0:00   ` Franck Arnaud
  -- strict thread matches above, loose matches on Subject: below --
1997-09-12  0:00 Interface/Implementation (was Re: Design by Contract) 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
     [not found] <01bcb389$24f579d0$1c10d30a@ntwneil>
1997-08-28  0:00 ` Tucker Taft
1997-08-29  0:00   ` 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
     [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                 ` 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                       ` Nick Leaton
1997-09-10  0:00                         ` W. Wesley Groleau x4923
1997-09-12  0:00                         ` Robert Dewar
1997-09-12  0:00                           ` Nick Leaton
1997-09-11  0:00                       ` Robert Dewar
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-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               ` Patrick Doyle
1997-09-05  0:00                 ` W. Wesley Groleau x4923
1997-09-06  0:00                   ` Patrick Doyle
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             ` Matthew Heaney
1997-09-06  0:00               ` Matt Kennel (Remove 'NOSPAM' to reply)
1997-09-06  0:00                 ` Jon S Anthony
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                         ` 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                         ` Tucker Taft
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                           ` 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                         ` Samuel Mize
1997-09-10  0:00                           ` Samuel Mize
1997-09-11  0:00                           ` Don Harrison
1997-09-11  0:00                           ` Robert Dewar
1997-09-12  0:00                             ` Samuel T. Harris
1997-09-12  0:00                             ` Samuel Mize
1997-09-13  0:00                               ` Tucker Taft
1997-09-17  0:00                             ` Don Harrison
1997-09-18  0:00                               ` Robert Dewar
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-08  0:00               ` John G. Volan
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
1997-09-09  0:00                 ` Paul Johnson
     [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-04  0:00           ` Erik Ernst
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-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                                             ` 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                                             ` 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                                           ` 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                                                 ` 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-10  0:00                                                 ` Joachim Durchholz
1997-09-12  0:00                                                   ` Joerg Rodemann
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