comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Need advice re package organization.
Date: Thu, 31 Jul 2003 11:04:59 +0200
Date: 2003-07-31T11:04:59+02:00	[thread overview]
Message-ID: <jtkhivs294g51t3mfdbbj84mbcq1amn7fe@4ax.com> (raw)
In-Reply-To: clWVa.4191$mv6.741217@news20.bellglobal.com

On Wed, 30 Jul 2003 17:00:00 -0400, "Warren W. Gay VE3WWG"
<ve3wwg@cogeco.ca> wrote:

>Dmitry A. Kazakov wrote:

>> Such subroutines could be viewed as an
>> equivalent to C++'s "private methods". What Ada does not have are
>> private data members in C++ sense. So we have:
>> 
>> protected in C++ <--> private in Ada
>> private method <--> a subroutine in the body [a FAT plus to Ada ]
>> private member  <--> missing [a minus]
>
>I think you need to add a dimension to this "chart", because
>there are multiple (at least 2) views:
>
>   1. simple client view
>   2. a _normal_ child package view
>
>   (a _private_ child's view is the same I think, but if not, this
>    is a 3rd).
>
>The problem I am trying to address, is #2. The child package sees
>all, even when you don't want it to.

But if you do not want to see private things, then the package should
not be a child.

-----------------------------------------
However I should admit that there is a problem, not only in Ada, but
it other OO languages too. It is a "philosophic" problem:

"When implemening a method should I favour private or public
interface?"

Note that this problem exists even for a single package / class. Let I
have a public Getter for some hidden member, should I use it instead
of accessing the member directly implementing some other method?

There is no definite answer to this, but in what a language (Ada)
could help is in a clear separation of both.

As a raw idea, one could have public and private parts of the package
body. Or alternatively, one could have up to two bodies, private and
public:

package [private] body A is
   -- I see everything
   -- All dirty stuff goes here
end A;

package public body A is
   -- I see only the public part
   -- I need not review this body as long as the public part
   -- remains unchanged
end A;

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  parent reply	other threads:[~2003-07-31  9:04 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
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 [this message]
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