comp.lang.ada
 help / color / mirror / Atom feed
From: jgv@swl.msd.ray.com (John Volan)
Subject: Re: SOLVED! Decoupled Mutual Recursion Challenger
Date: Wed, 19 Oct 1994 16:35:45 GMT
Date: 1994-10-19T16:35:45+00:00	[thread overview]
Message-ID: <1994Oct19.163545.4697@swlvx2.msd.ray.com> (raw)
In-Reply-To: CxwGJF.FwB@ois.com

beckwb@ois.com (R. William Beckwith) writes:

>John Volan (jgv@swl.msd.ray.com) wrote:

>: I would
>: argue that such a scheme falls into the trap of "inheritance
>: collision", where one usage of inheritance (providing alternate
>: programming-interface views for a single class of real-world entities)
>: gets in the way of the "customary" use of inheritance (supporting
>: generalization-specialization relationships between different classes
>: of real-world entities).

>It shouldn't because we are just added an intermediate level of
>inheritance between each "customary" use of inheritance.  

Doing that will work -- until we have to establish a mutually
recursive association between a class and *one of its own subclasses*.
That was the "acid test" that I posed in my original "Challenge".
Consider the Rooster class in my (admittedly bizarre) example.  The
Rooster class must somehow be "forward declared" before the spec of
the Chicken class so that the Chicken class can include Rooster-related
primitive operations. But ultimately, the Rooster class must *inherit*
from the Chicken class.  How can the Rooster interface be *derived* from
the forwarded Rooster declaration, *and* also inherit from the Chicken
interface?  This is what I've been calling "inheritance collision."

>But,
>the effect of this is that you don't achieve true decoupling.

Well, maybe we're using different definitions of "decoupling", because
I'd say that your original scheme *did* in fact achieve decoupling --
except that it breaks down when pushed to the limit, because of
"inheritance collision".  That's why I'd encourage you to use
generics for decoupling, rather than inheritance.

By the way, folks, an association between a class and one of its own
subclasses is *not* a rare or obscure occurrence, in fact it happens
all the time.  Consider, for instance, a file system, where a
"directory" is a kind of "file" that can contain other "files"
(including other "directories").  Another example is an
object-oriented drawing editor that allows "grouping" of drawable
objects.  A "group" is itself a kind of "drawable object" that
contains other "drawable objects" (including, perhaps, other
"groups").  There are many other similar situations.  Not all of these
associations have to be implemented in a mutually-recursive way,
necessarily, but being able to make even these associations mutually
recursive *and* decoupled is the ultimate test of any scheme for
decoupled mutual recursion, IMHO.

-- John Volan

--------------------------------------------------------------------------------
--  Me : Person := (Name                => "John Volan",
--                  Company             => "Raytheon Missile Systems Division",
--                  E_Mail_Address      => "jgv@swl.msd.ray.com",
--                  Affiliation         => "Enthusiastic member of Team Ada!",
--                  Humorous_Disclaimer => "These opinions are undefined " &
--                                         "by my employer and therefore " &
--                                         "any use of them would be "     &
--                                         "totally erroneous.");
--------------------------------------------------------------------------------




  parent reply	other threads:[~1994-10-19 16:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-12 22:49 SOLVED! Decoupled Mutual Recursion Challenger John Volan
1994-10-17 15:48 ` John Volan
1994-10-17 17:55   ` Bob Duff
1994-10-17 20:52     ` John Volan
1994-10-17 22:10       ` Bob Duff
1994-10-18 22:17         ` John Volan
1994-10-19  1:01           ` Bob Duff
1994-10-19  4:45             ` Jay Martin
1994-10-19 14:38               ` Mark A Biggar
     [not found]                 ` <38fi4r$l81@oahu.cs.ucla.edu>
1994-10-24 11:49                   ` Mutual Recursion Challenge Robert I. Eachus
1994-10-24 20:32                     ` John Volan
1994-10-26 11:42                       ` Generic association example (was Re: Mutual Recursion Challenge) Robert I. Eachus
1994-10-26 23:21                         ` John Volan
1994-10-27 10:53                           ` Robert I. Eachus
1994-10-31 17:34                             ` John Volan
1994-10-27 14:37                           ` Mark A Biggar
1994-10-24 17:42                   ` SOLVED! Decoupled Mutual Recursion Challenger John Volan
1994-10-24 22:37                     ` Jay Martin
1994-10-25  5:47                       ` Matt Kennel
1994-10-25 10:04                         ` David Emery
1994-10-25 16:43                         ` John Volan
1994-10-27  4:25                           ` Rob Heyes
1994-10-28  9:03                             ` Mutual Recursion (was Re: SOLVED! Decoupled Mutual Recursion Challenger) Robert I. Eachus
1994-10-28 15:04                             ` SOLVED! Decoupled Mutual Recursion Challenger Robb Nebbe
1994-10-25 15:54                       ` John Volan
1994-10-26  1:24                         ` Bob Duff
1994-10-28  4:28                         ` Jay Martin
1994-10-28 10:52                           ` Robert I. Eachus
1994-10-28 18:46                             ` Jay Martin
1994-11-02 14:56                               ` Robert I. Eachus
1994-10-29  0:38                           ` Bob Duff
1994-10-29  7:26                             ` Jay Martin
1994-10-29 11:59                             ` Richard Kenner
1994-10-31 13:17                               ` Robert Dewar
1994-10-31 14:13                               ` gcc distribution (was: SOLVED! Decoupled Mutual Recursion Challenger) Norman H. Cohen
1994-11-02 14:14                                 ` Richard Kenner
1994-11-04 23:56                                   ` Michael Feldman
1994-10-31 18:44                           ` SOLVED! Decoupled Mutual Recursion Challenger John Volan
1994-10-20 11:25               ` Robb Nebbe
1994-10-20 19:19                 ` John Volan
1994-10-26  0:07                 ` Mark S. Hathaway
1994-10-26 18:48                 ` gamache
1994-10-27  2:15                   ` John Volan
     [not found]           ` <CxwGJF.FwB@ois.com>
1994-10-19 16:35             ` John Volan [this message]
1994-10-17 22:54   ` Cyrille Comar
replies disabled

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