Subject Re: [IBO] Data Module Inheritance
Author paultugwell <pault@guardbase.co.uk>
--- In IBObjects@yahoogroups.com, "paultugwell <pault@g...>"
<pault@g...> wrote:
> --- In IBObjects@yahoogroups.com, "Brian K. Woods" <brian@e...>
wrote:
> > > -----Original Message-----
> > > From: paultugwell <pault@g...> [mailto:pault@g...]
> > > Sent: Friday, January 10, 2003 5:17 AM
> > > To: IBObjects@yahoogroups.com
> > > Subject: [IBO] Data Module Inheritance
> > >
> > >
> > > I have just started a project where there will be a number of
> exe's
> > > all using a common set of basic queries to which the queries
> specific
> > > to the particular exe would be added. I thought I'd be clever
and
> > > create a data module containing these queries and save it in the
> > > object repository. The data modules in the individual exe's
would
> > > then be created by inheritence. This work except for one thing.
> The
> > > base datamodule contains a TIBODatabase with the DatabaseName
> > > property set to SYS. When I create the inherited data module the
> > > DatabaseName is shown as SYS_1. Connecting SYS_1 creates only
one
> > > connection to IB (as shown by IB_SQL) but SYS also shows as
> > > connected. However, connecting SYS does not connect SYS_1.
> > > Is this process valid and will it cause me any problems?
> >
> > I'm not one with the knowledge to accurately tell you if there
are
> problems
> > with it as
> > far as connections, etc goes. However, the programmer in me
> doesn't like it
> > since it's just
> > not clean design, as I figure the programmer in you must be
> throwing red
> > flags, too (else you wouldn't ask...)
> >
> > My suggestion: why don't you replace the TIBODatabase in the base
> datamodule
> > class with a TIBODatabase property, that
> > gets supplied in a virtual constructor or property when you
create
> the
> > descendant instance? That
> > gets rid of your duplicate database objects as well as avoids any
> hidden
> > problems that they might or
> > might not cause. Base classes don't really need anything except
the
> > interface anyway, since you don't generally
> > create an instance of a base class.
> >
> > HTH,
> > Brian
>

Isn't it funny how you always notice the error in your typing just
after you've clicked the send button!! My message should have read

Interseting idea, but this is not really the answer in this case. As
well as the datamodule itself being common to a number of programs,
the TIBODatabase objects and a number of queries will also be common.
My motivation in doing this was to enable me to reuse the queries in
different profgram.