From: cjames@melchizedek.cec-services.com (The Right Reverend Colin James III)
Subject: Re: Real OO
Date: 1996/03/18
Date: 1996-03-18T00:00:00+00:00 [thread overview]
Message-ID: <314d98bf.562645731@news.dimensional.com> (raw)
In-Reply-To: 4ik3j7$cl6@watnews1.watson.ibm.com
ncohen@watson.ibm.com (Norman H. Cohen) posted with deletions:
| In article <4id031$cf9@dayuc.dayton.saic.com>, John G. Volan
| <John_Volan@ccmail.dayton.saic.com> writes (concerning the division of a
| tagged type's interfaces into multiple subinterfaces for different
| clients):
|
| |> Here's an alternative approach that is subtly -- but significantly --
| |> different: Make the subprograms in the child packages _classwide_
| |> operations, and have them _dispatch_ to the private primitives:
| |>
| |> package Abstraction_1 is
| |> type T is tagged null record;
| |> private
| |> procedure Op_1 (X: in out T); -- for Specialty_1
| |> procedure Op_2 (X: in out T); -- for Specialty_2
| |> end Abstraction_1;
| |>
| |>
| |> package Abstraction_1.Specialty_1 is
| |> procedure Op_1 (X: in out T'Class); -- classwide operation
| |> pragma Inline (Op_1);
| |> end Abstraction_1.Specialty_1;
| |>
| |> package body Abstraction_1.Specialty_1 is
| |> procedure Op_1 (X: in out T'Class) is
| |> begin
| |> Abstraction_1.Op_1 (X); -- dispatching call
| |> end Op_1;
| |> end Abstraction_1.Specialty_1;
| ...
| |> package Abstraction_1.Specialty_2 is
| |> procedure Op_2 (X: in out T'Class); -- classwide operation
| |> pragma Inline (Op_2);
| |> end Abstraction_1.Specialty_2;
| |>
| |> package body Abstraction_1.Specialty_2 is
| |> procedure Op_2 (X: in out T'Class) is
| |> begin
| |> Abstraction_1.Op_2 (X); -- dispatching call
| |> end Op_2;
| |> end Abstraction_1.Specialty_2;
|
| Yes, this is an excellent paradigm! Extending T means that there is more
| than one kind of T, but that the two subinterfaces are designed to
| perform particular functions with any kind of T that comes along. The
| fact that there is more than one kind of T is irrelevant to the users of
| these packages, as long as Op_1 or Op_2 does the appropriate thing for
| any kind of T that is encountered. Defining "the right thing" is the
| responsibility of the programmer extending T.
|
| ...
| |> (In fact, I'd say in general that any operation ought to be classwide if
| |> it isn't explicitly a primitive. IMHO, only under very rare
| |> circumstances should a non-primitive operation restrict a parameter to
| |> accept only a specific root type but not any of its derived types.)
|
| By instinct, I'm wary of such sweeping generalizations. However, it
| would appear that John's approach is the appropriate one in many
| circumstances.
|
| ...
| |> (Well, this whole discussion might be a lot clearer if we had a more
| |> concrete example that exhibited this kind of pattern. Ideas anyone?)
|
| My canonical example of an abstraction that has different interfaces for
| different clients is a device driver, or more precisely, an abstract
| device state. There are certain operations meant to be invoked from
| interrupt handlers as the result of events in a device; there are other
| operations meant to be invoked from application programs using the
| device.
|
| One can define an abstract tagged type for device states, together with
| dispatching operations, in a parent package. Separate child packages,
| one providing an interface for interrupt handlers and one providing an
| interface for applications, can define classwide versions of those
| operations appropriate for each interface. These classwide versions
| simply invoke the corresponding dispatching operation of the abstract
| tagged type.
|
| For each kind of phyiscal device, one derives from the abstract type,
| overriding all its operations. Given an object corresponding to a
| particular kind of physical device, a client (either an interrupt handler
| or an application) continues to simply invoke the corresponding classwide
| operation, which dutifully makes a dispatching call that dispatches to
| the overriding subprogram defined for the appropriate derived type. This
| isolates clients from the details of physical devices and makes it
| unnecessary to modify clients when new physical devices arise.
|
| (Of course a new physical device may make a new kind of abstract
| operation possible. This will be defined as a primitive operation of the
| corresponding derived type. Children of the packages providing
| interrupt-handler and client interfaces can provide corresponding
| classwide operations for use by clients.* Thus application clients CAN be
| modified to take advantage of the special characteristics of a new
| physical device, as a result of a deliberate decision to upgrade the
| application. However, this is not NECESSARY: A client that was working
| before the new physical device was added will continue working, so the
| client can be upgraded at our leisure or not at all.)
|
| *-To avoid the need for clients to become aware of whether a given
| abstract device supports the new operation, the classwide operation
| should accept a parameter of the classwide type of the original root
| abstract type and check whether the object belongs to a class for which
| dispatching is possible. If not, the classwide type should provide an
| appropriate response--perhaps an expensive emulation of the new
| operation using the old operations common to all devices.
|
| --
| Norman H. Cohen ncohen@watson.ibm.com
This has nothing to do with Eiffel, does it.
So stop distributing your inane thread to comp.lang.eiffel.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Colin James III, Principal Scientist cjames@cec-services.com
CEC Services, 2080 Kipling St, Lakewood, CO 80215-1502 USA
Voice: 303.231.9437; Facsimile: .231.9438; Data: .231.9434
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
next prev parent reply other threads:[~1996-03-18 0:00 UTC|newest]
Thread overview: 218+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4id031$cf9@dayuc.dayton.saic.com>
1996-03-18 0:00 ` Real OO Norman H. Cohen
1996-03-18 0:00 ` The Right Reverend Colin James III [this message]
1996-03-19 0:00 ` Norman H. Cohen
1996-03-20 0:00 ` Norman Cohen giving IBM a bad name The Right Reverend Colin James III
1996-03-20 0:00 ` Colin James III giving humans a bad name (was Re: Norman Cohen giving IBM a bad name) David Emery
1996-03-20 0:00 ` Mark R Okern - F95
1996-03-20 0:00 ` Real OO John G. Volan
1996-03-21 0:00 ` Scott Leschke
1996-03-21 0:00 ` Norman H. Cohen
1996-03-21 0:00 ` Robert A Duff
1996-03-22 0:00 ` Don Harrison
1996-03-21 0:00 ` Colin James III giving humans a bad name (was Re: Norman Cohen giving IBM a bad name) Richard A. O'Keefe
1996-03-21 0:00 ` Robert Dewar
1996-03-20 0:00 ` Norman Cohen giving IBM a bad name Brian & Karen Bell
1996-03-20 0:00 ` Real OO Dale Stanbrough
1996-03-21 0:00 ` Richard Pitre
1996-03-20 0:00 ` Norman Cohen giving IBM a bad name Dave Retherford
1996-03-21 0:00 ` Kent Mitchell
1996-03-22 0:00 ` Robert Munck
1996-03-22 0:00 ` Mark Brennan
1996-03-22 0:00 ` David Curry
1996-03-23 0:00 ` Tom Reid
1996-03-21 0:00 ` Real OO Don Harrison
1996-03-21 0:00 ` Colin James III giving humans a bad name (was Re: Norman Cohen giving IBM a bad name) Ulrich Windl
1996-03-20 0:00 ` Real OO Don Harrison
1996-03-22 0:00 ` Don Harrison
1996-03-22 0:00 ` Norman H. Cohen
1996-03-27 0:00 ` Don Harrison
1996-03-27 0:00 ` Norman H. Cohen
1996-03-28 0:00 ` Jacob Gore
1996-04-04 0:00 ` Don Harrison
1996-04-04 0:00 ` Laurent Guerby
1996-04-04 0:00 ` Robb Nebbe
1996-04-04 0:00 ` Tucker Taft
1996-04-04 0:00 ` Tucker Taft
1996-04-12 0:00 ` Don Harrison
1996-04-12 0:00 ` Don Harrison
1996-04-15 0:00 ` Robert I. Eachus
1996-04-19 0:00 ` Don Harrison
1996-04-19 0:00 ` Matt Kennel
1996-04-20 0:00 ` Bob Hathaway
1996-04-23 0:00 ` Don Harrison
1996-04-04 0:00 ` Jon S Anthony
1996-03-22 0:00 ` Norman H. Cohen
1996-03-26 0:00 ` Don Harrison
1996-03-26 0:00 ` Norman H. Cohen
1996-03-29 0:00 ` Don Harrison
1996-03-27 0:00 ` Thomas Beale
1996-03-28 0:00 ` Don Harrison
1996-03-23 0:00 ` Joachim Durchholz
1996-03-26 0:00 ` Norman H. Cohen
1996-04-04 0:00 ` Don Harrison
1996-04-04 0:00 ` Jon S Anthony
1996-04-12 0:00 ` Don Harrison
1996-04-17 0:00 ` Jon S Anthony
1996-04-19 0:00 ` Don Harrison
1996-04-19 0:00 ` Jon S Anthony
1996-04-23 0:00 ` Don Harrison
1996-04-24 0:00 ` Don Harrison
1996-04-29 0:00 ` Jon S Anthony
1996-04-30 0:00 ` Robert Dewar
1996-04-30 0:00 ` Robert A Duff
1996-04-30 0:00 ` Amit Patel
1996-04-30 0:00 ` Robert Dewar
1996-05-01 0:00 ` Richard Bielak
1996-05-01 0:00 ` Adam Beneschan
1996-05-02 0:00 ` Ell
1996-04-30 0:00 ` Amit Patel
1996-04-30 0:00 ` Robert A Duff
1996-05-07 0:00 ` Amit Patel
1996-05-01 0:00 ` Norman H. Cohen
1996-05-01 0:00 ` Colin James III (The Rt Rev'd)
1996-05-07 0:00 ` Amit Patel
1996-05-01 0:00 ` Don Harrison
1996-05-01 0:00 ` Don Harrison
1996-05-02 0:00 ` Robert A Duff
1996-05-03 0:00 ` Don Harrison
1996-05-03 0:00 ` Robert A Duff
1996-05-06 0:00 ` Don Harrison
1996-05-06 0:00 ` Robb Nebbe
1996-05-06 0:00 ` Robert A Duff
1996-05-01 0:00 ` David Hopwood
1996-05-03 0:00 ` Don Harrison
1996-05-02 0:00 ` Robert A Duff
1996-05-03 0:00 ` Don Harrison
1996-05-10 0:00 ` Don Harrison
1996-05-01 0:00 ` AdaWorks
1996-05-08 0:00 ` Joachim Durchholz
1996-05-03 0:00 ` Don Harrison
1996-05-03 0:00 ` Dave Fitch
1996-05-07 0:00 ` Jon S Anthony
1996-04-30 0:00 ` Joachim Durchholz
1996-04-30 0:00 ` Jon S Anthony
1996-05-01 0:00 ` Matt Kennel
1996-05-03 0:00 ` Don Harrison
1996-05-02 0:00 ` Don Harrison
1996-05-02 0:00 ` Robert I. Eachus
1996-05-02 0:00 ` Jon S Anthony
1996-05-03 0:00 ` Don Harrison
1996-05-06 0:00 ` Jon S Anthony
1996-05-06 0:00 ` Jon S Anthony
1996-05-06 0:00 ` Don Harrison
1996-05-06 0:00 ` Don Harrison
1996-05-07 0:00 ` Jon S Anthony
1996-05-13 0:00 ` Don Harrison
1996-05-09 0:00 ` Jon S Anthony
1996-04-19 0:00 ` Multiple Dispatch in Ada 95 (Was Re: Real OO) Brian Rogoff
1996-04-21 0:00 ` Brian Rogoff
1996-04-19 0:00 ` Robert I. Eachus
1996-04-20 0:00 ` Brian Rogoff
1996-04-21 0:00 ` Robert A Duff
1996-04-24 0:00 ` Real OO Joachim Durchholz
1996-05-01 0:00 ` Matt Kennel
1996-05-02 0:00 ` Don Harrison
1996-05-07 0:00 ` Joachim Durchholz
1996-05-08 0:00 ` Jon S Anthony
1996-05-09 0:00 ` Robert I. Eachus
1996-04-30 0:00 ` Jon S Anthony
1996-05-03 0:00 ` Don Harrison
1996-05-07 0:00 ` Jon S Anthony
1996-04-30 0:00 ` Joachim Durchholz
1996-05-08 0:00 ` Joachim Durchholz
1996-05-10 0:00 ` Jon S Anthony
1996-05-02 0:00 ` Jon S Anthony
1996-05-06 0:00 ` Jon S Anthony
1996-04-08 0:00 ` Norman H. Cohen
1996-04-08 0:00 ` Robert A Duff
1996-04-09 0:00 ` Norman H. Cohen
1996-04-10 0:00 ` Don Harrison
1996-04-11 0:00 ` Jacob Gore
1996-04-12 0:00 ` Don Harrison
1996-04-12 0:00 ` Jon S Anthony
1996-04-13 0:00 ` Robert A Duff
1996-04-12 0:00 ` Matt Kennel
1996-04-15 0:00 ` Don Harrison
1996-04-16 0:00 ` Jon S Anthony
1996-04-12 0:00 ` Don Harrison
1996-04-12 0:00 ` Jacob Gore
1996-04-16 0:00 ` Don Harrison
1996-04-09 0:00 ` Jon S Anthony
1996-04-09 0:00 ` Valery CROIZIER
1996-04-09 0:00 ` Joachim Durchholz
1996-05-02 0:00 ` Joachim Durchholz
1996-05-05 0:00 ` Robert A Duff
1996-05-05 0:00 ` Robert Dewar
1996-05-06 0:00 ` Norman H. Cohen
1996-05-07 0:00 ` Ada terminology (was Re: Real OO) David Hopwood
1996-05-07 0:00 ` Dave Jones
1996-05-07 0:00 ` Tucker Taft
1996-05-07 0:00 ` The Right Reverend Colin James III
1996-05-08 0:00 ` bill.williams
1996-05-07 0:00 ` The Right Reverend Colin James III
1996-05-07 0:00 ` Real OO Don Harrison
1996-05-07 0:00 ` Jon S Anthony
1996-05-08 0:00 ` Don Harrison
1996-05-08 0:00 ` Norman H. Cohen
1996-05-08 0:00 ` Robert A Duff
1996-05-10 0:00 ` Matt Kennel
1996-05-10 0:00 ` Robert A Duff
1996-05-14 0:00 ` Matt Kennel
1996-05-15 0:00 ` Robert A Duff
1996-05-07 0:00 ` Amit Patel
1996-05-07 0:00 ` The Right Reverend Colin James III
1996-05-08 0:00 ` Don Harrison
1996-05-08 0:00 ` Juergen Schlegelmilch
[not found] ` <Dr4538.D27@assip.csasyd.oz>
1996-05-09 0:00 ` Juergen Schlegelmilch
1996-05-09 0:00 ` Richard Riehle
1996-05-10 0:00 ` Tucker Taft
1996-05-13 0:00 ` Don Harrison
1996-05-13 0:00 ` Tucker Taft
1996-05-14 0:00 ` Roger Browne
1996-05-14 0:00 ` Joachim Durchholz
1996-05-14 0:00 ` Don Harrison
1996-05-14 0:00 ` Robert A Duff
1996-05-14 0:00 ` Steve Tynor
1996-05-14 0:00 ` Robert A Duff
1996-05-15 0:00 ` Don Harrison
1996-05-15 0:00 ` Steve Tynor
1996-05-15 0:00 ` Robert A Duff
1996-05-16 0:00 ` James McKim
1996-05-18 0:00 ` Matt Kennel
1996-05-20 0:00 ` James McKim
1996-05-22 0:00 ` Matt Kennel
1996-05-15 0:00 ` Steve Tynor
1996-05-15 0:00 ` Alexander Kjeldaas
1996-05-19 0:00 ` Piercarlo Grandi
1996-05-14 0:00 ` James McKim
1996-05-15 0:00 ` Juergen Schlegelmilch
1996-05-20 0:00 ` Joachim Durchholz
1996-05-07 0:00 ` Joachim Durchholz
1996-05-09 0:00 ` Don Harrison
1996-05-09 0:00 ` Joachim Durchholz
1996-05-09 0:00 ` Jon S Anthony
1996-04-02 0:00 ` Detecting type mismatch at compile time (was Re: Real OO) Robert I. Eachus
1996-04-03 0:00 ` Richard Bielak
1996-04-04 0:00 ` Don Harrison
1996-03-28 0:00 ` Real OO Joachim Durchholz
1996-03-29 0:00 ` Norman H. Cohen
1996-03-30 0:00 ` John G. Volan
1996-03-26 0:00 ` Jon S Anthony
1996-03-29 0:00 ` Joachim Durchholz
1996-04-04 0:00 ` Don Harrison
1996-04-04 0:00 ` Dominique Colnet
1996-04-04 0:00 ` Steve Tynor
1996-04-08 0:00 ` Norman H. Cohen
1996-04-09 0:00 ` Matt Kennel
1996-04-08 0:00 ` Matt Kennel
1996-04-09 0:00 ` Norman H. Cohen
1996-04-09 0:00 ` Robert C. Martin
1996-04-10 0:00 ` J. Kanze
1996-05-02 0:00 Bob Crispen
[not found] <DoDLr7.JDB@world.std.com>
[not found] ` <4if7s5$bfk@ra.nrl.navy.mil>
[not found] ` <DoDqH4.29v@world.std.com>
1996-03-26 0:00 ` AdaWorks
1996-03-29 0:00 ` Brian Rogoff
[not found] <4hneps$1238@watnews1.watson.ibm.com>
[not found] ` <Do3F1K.4xG@assip.csasyd.oz>
[not found] ` <4i455s$ijq@watnews1.watson.ibm.com>
1996-03-15 0:00 ` Don Harrison
[not found] ` <DoBH80.9u9@world.std.com>
1996-03-15 0:00 ` Mark A Biggar
1996-03-15 0:00 ` Richard Pitre
1996-03-16 0:00 ` Des Kenny
[not found] <JSA.96Mar13143956@organon.com>
1996-03-15 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