From: "Matthew Heaney" <matthewjheaney@earthlink.net>
Subject: Re: Need advice re package organization.
Date: Thu, 31 Jul 2003 05:57:25 GMT
Date: 2003-07-31T05:57:25+00:00 [thread overview]
Message-ID: <9d2Wa.301$jp.253@newsread4.news.pas.earthlink.net> (raw)
In-Reply-To: clWVa.4191$mv6.741217@news20.bellglobal.com
"Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca> wrote in message
news:clWVa.4191$mv6.741217@news20.bellglobal.com...
>
> The problem occurs in the private child package (IMO) because
> you want to derive new objects from parent tagged records. The
> danger that develops is that the child package's body code may
> monkey with things in the parent object that you don't want it
> to (this is lack of information hiding).
That the private part of the parent package is visible to (the private part
of) a child is a feature of the language.
Yes, there is a "lack of information hiding," but the syntax of the language
is designed so that it's obvious who has access to the private information,
e.g. if I see P.C, I know that C has visibility to P.
This is a consequence of the fact that visibility in Ada is controlled by
the module relationship. One issue in C++ is that if I have:
class B
{
public:
virtual ~B();
protected:
secret_t m_secret;
};
then yes, this says that data member m_secret is visible to classes that
derive from B, but there's nothing that identifies which classes those are.
If I see a class D, there's nothing to tell me that D derives from B (unless
you look at D's declaration, of course).
This is why I usually name derived classes by tacking the derived name onto
the base class name, e,g
class Presentation { /* ... */ };
class PresentationAVI : public Presentation { /* ... */ };
etc
class Stream { /* ... */ };
class StreamAVI : public Stream { /* ... */ };
class StreamWAV : public Stream { /* ... */ };
etc.
At least in Ada, if I have one type that derives from another, e.g.
package P is
type T is tagged ...;
...
end P;
package P.C is
type NT is new T with ...;
...
end P.C;
then at least when I see P.C.NT, I know immediately that C can see the
private part of P.
So I don't agree that one should that a parent package should try to "hide"
stuff from a child. The set of modules that have visibility to the private
part of P (and hence, that need to be consulted if there is a change) is
bounded, and clearly demarcated. In the typical case the members of a
package hierarchy (the "subsystem") would be kept together in a project,
probably in the same directory, and maintained by a single person.
next prev parent reply other threads:[~2003-07-31 5:57 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 [this message]
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