Re: Clean Object Class Design -- What is it?

From: Craig Shearer <craig.shearer_at_no_spam_please_bigfoot.com>
Date: Mon, 3 Sep 2001 10:40:38 +1200
Message-ID: <3b92b65d$1_at_clear.net.nz>


"Bob Badour" <bbadour_at_golden.net> wrote in message news:YtTj7.600$Hl.123494514_at_radon.golden.net...
>
> Craig Shearer wrote in message <3b8e9bff$1_at_clear.net.nz>...
> >
> >"Sascha Bohnenkamp" <bonito_at_mevis.de> wrote in message
> >news:3B8E1FC3.D4F6EED7_at_mevis.de...
> >> > And
> >> > for bi-directional associations, it enforces referential integrity.
> >> which OODBMS does this and what is the kind of 'enforcement'?
> >> Is it only a setting of the bi-link to NULL or more?
> >> (rdbms forbid those actions or do a delete on cascade if you want them
> >> to)
> >
> >The ODBMS I use (JADE) does this. You define inverse relationships
between
> >reference properties (either singular references or collections) on
> classes.

> >When you define the inverse, you also define whether the relationship is
> >parent-child or peer-peer. In the case of a parent-child relationship, if
> >the parent object is deleted, then this will cascade delete the child
> >object. In the peer-peer case, deleting the object at one side of the
> >relationship will automatically update the other object's reference to it
> to
> >null.
>
> Who says it should even allow the delete in the first place? Are all
> references symmetric?
>
>
>

If you're asking about Integrity Checking, then there is no formal mechanism for defining this. However, it is possible to define code in the destructor for the class that would raise an exception under certain circumstances, thus preventing deletion by forcing the transaction to abort.

I'm not certain what you mean by symmetric references, but I'll hazard a guess. When references between classes are defined, you specify an update mode - effectively which side is manually maintained. So, if the relationship defines manual on one side and automatic on the other, then the compiler will reject (with a syntax error) code attempting to update the automatic side of the relationship. It is possible, though, to define both sides as manual/automatic, meaning that whichever side is maintained manually, the other side will be automatically maintained.

Craig. Received on Mon Sep 03 2001 - 00:40:38 CEST

Original text of this message