comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Riehle <richard@adaworks.com>
Subject: Re: Need advice re package organization.
Date: Mon, 28 Jul 2003 21:52:09 -0700
Date: 2003-07-29T04:49:34+00:00	[thread overview]
Message-ID: <3F25FD78.16C87D8D@adaworks.com> (raw)
In-Reply-To: 3F24900B.8020002@attbi.com

"Robert I. Eachus" wrote:

> chris wrote:
> > What is a private child package?
>
> private package Parent.Private_Child is... end Parent.Private_Child;
>
> See RM 10.1.1(12), and 10.1.2(8). Probably one of the best kept secrets
> in Ada 95.  A private child package can have a with clause for another
> private child of the same parent (or ancestor package), but the real use
> is that the body of the parent package or any sibling can with the
> private package.

One of the most ideas related to private children is the potential for
aspect-oriented programming (AOP).   The idea of cross-cutting
common facilities across a larger design while preserving encapsulation
is nicely accomplished with private chilren.

> So if you have common utility routines that you don't want to make part
> of the parent's package spec, put them in a private child.  For example,
> the parent package might export a private type, and the private child
> could include the inquiry functions and other operations that needed to
> see into the private part of the parent.

This allows us to promote any feature of a package body to a private
package specification.  What this means is that the package body
should only contain implementations in the specification.  Any other
functions or procedures should be declared in a private package
specification.  Once this is done,  those specifications are themselves
extensible.   Also, every set of subprograms is declared at the
specification level.  Voila, we have a model for AOP.

Of course, I do oversimplify in this description, but anyone who
explores this in depth will soon discover the validity of this
notion.

Richard Riehle




  reply	other threads:[~2003-07-29  4:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-26 13:08 Need advice re package organization Bobby D. Bryant
2003-07-26 14:25 ` Robert I. Eachus
2003-07-26 15:27   ` Warren W. Gay VE3WWG
2003-07-26 22:00     ` Robert I. Eachus
2003-07-27 22:01       ` chris
2003-07-28  2:53         ` Robert I. Eachus
2003-07-29  4:52           ` Richard Riehle [this message]
2003-07-27 22:02       ` Warren W. Gay VE3WWG
2003-07-28  8:38         ` Dmitry A. Kazakov
2003-07-29 17:18           ` Warren W. Gay VE3WWG
2003-07-30  8:42             ` Dmitry A. Kazakov
2003-07-30 21:00               ` Warren W. Gay VE3WWG
2003-07-30 22:46                 ` Randy Brukardt
2003-07-31 16:39                   ` Warren W. Gay VE3WWG
2003-07-31 17:31                     ` Randy Brukardt
2003-07-31 21:00                       ` Warren W. Gay VE3WWG
2003-07-31 22:13                     ` Robert I. Eachus
2003-08-01 12:51                       ` Warren W. Gay VE3WWG
2003-07-31  5:57                 ` Matthew Heaney
2003-07-31 16:57                   ` Warren W. Gay VE3WWG
2003-07-31 22:33                     ` Robert I. Eachus
2003-08-01  2:58                       ` Chad R. Meiners
2003-08-01 13:51                         ` Stephen Leake
2003-08-01 22:15                           ` Robert I. Eachus
2003-08-04 13:45                             ` Stephen Leake
2003-08-01 13:01                       ` Warren W. Gay VE3WWG
2003-07-31  9:04                 ` Dmitry A. Kazakov
2003-07-31 16:59                   ` Warren W. Gay VE3WWG
2003-07-31 20:41                     ` Randy Brukardt
2003-07-31 21:15                       ` Warren W. Gay VE3WWG
2003-08-01 20:04                         ` Randy Brukardt
2003-08-01 21:33                           ` Stephen Leake
2003-08-04 19:40                             ` Randy Brukardt
2003-08-04 19:52                               ` Stephen Leake
2003-08-05  3:36                   ` Richard Riehle
2003-08-05  4:03                     ` Hyman Rosen
2003-08-05  7:16                     ` Dmitry A. Kazakov
2003-07-26 17:03 ` Nick Roberts
replies disabled

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