comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Mutual Recursion Challenge
Date: 24 Oct 94 11:49:25
Date: 1994-10-24T11:49:25+00:00	[thread overview]
Message-ID: <EACHUS.94Oct24114925@spectre.mitre.org> (raw)
In-Reply-To: jmartin@oahu.cs.ucla.edu's message of 23 Oct 1994 22:53:31 -0700

In article <38fi4r$l81@oahu.cs.ucla.edu> jmartin@oahu.cs.ucla.edu (Jay Martin) writes:

  > All in all this method seems to have alot of programming and
  > conceptual overhead.  Also there will probably have to be a
  > section in every decent Ada9x programming book explaining this
  > method.

    I hope not.

    There are many features in Ada 9X which lead to a better approach
to OOP.  In particular, the mindset problem here is that the mutual
recursion must be between peers.  Ada 9X does a nice job on recursion
between objects at different levels of abstraction, and most of
difficulty in the examples comes from constructing two types at the
same level of abstraction and in different packages.

    In my (so far limited, as is everyone's) experience in Ada 9X, you
are much more likely to be adding an abstraction, using a generic
mixins, when the need for recursion occurs.  In those cases, all the
baggage discussed is either there for other reasons or not necessary.
It may seem that creating a dozen abstract types which are only there
as placeholders is a problem, but in fact the only problem I have
found with it is coming up with names.  (The best strategy I have
found is to use the base class name joined with the generic package
name as the name of the package instance:

    package Persons_Office_Assignment is new Office_Assignment(Person);

    and elsewhere:

    package Office_Staff_Assignment is new Staff_Assignment(Office);

    As this particular instantiation should make clear, package
Staff_Assignment may also be used to add staff to projects, to
departments, etc.  And in fact it might be better to have the
assignment package defined as a double generic as a much higher level
and instanced down, or just as a generic with two type parameters as
suggested earlier in this discussion.  (In such a model, Person and
Office would be instances of Objects, and Assignment would create a
relationship.)

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



  parent reply	other threads:[~1994-10-24 11:49 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                   ` Robert I. Eachus [this message]
1994-10-24 20:32                     ` Mutual Recursion Challenge 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
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