comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Classes and packages - recommended practice
Date: Mon, 12 Dec 2005 16:17:29 -0600
Date: 2005-12-12T16:17:29-06:00	[thread overview]
Message-ID: <ffmdncLG-JBoaADenZ2dnUVZ_tidnZ2d@megapath.net> (raw)
In-Reply-To: 439dc83c$0$27888$9b4e6d93@newsread4.arcor-online.net

"Georg Bauhaus" <bauhaus@futureapps.de> wrote in message
news:439dc83c$0$27888$9b4e6d93@newsread4.arcor-online.net...
> Maciej Sobczak wrote:
> > with Shapes;
> > use Shapes;
> [lots more]
>
> > My question is - when do you use which form?
>
> I'll rarely use all types from all packages in the same place when
> possible, because I want to leave that to the dispatching mechanism. :-)
> So this is not the most frequent case.

Right. In fact, it should never happen (because it creates a point where
maintenance is a problem; you won't get an error if you omit one of the
classes), unless you have very few classes.

Generally, you only use the root type (for dispatching) and a couple of the
leaf classes.

Anyway, to answer your original question, I generally use a flat set of
packages (because it is less likely to have unintentionally dependencies).
But there is one important exception: if the child classes need access to
details of the root classes implementation. In that case, the interesting
stuff gets put into the private part of the root class, and the child
packages can see it, but none of the clients can see it and mess up the
abstraction with inappropriate operations.

That is, I choose the flattest structure that is consistent with what needs
to be hidden from the clients.

                   Randy.






  reply	other threads:[~2005-12-12 22:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12 13:19 Classes and packages - recommended practice Maciej Sobczak
2005-12-12 18:58 ` Georg Bauhaus
2005-12-12 22:17   ` Randy Brukardt [this message]
2005-12-12 19:02 ` Martin Krischik
replies disabled

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