Re: Dependency / Constraint patch

From: Rod Taylor <rbt(at)zort(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Dependency / Constraint patch
Date: 2002-06-25 16:18:14
Message-ID: 1025021895.55512.37.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Tue, 2002-06-25 at 19:30, Tom Lane wrote:
> I've been looking at this, and the naming seems seriously confusing.
> Am I right in thinking that what the code consistently refers to as
> the "dependee" is actually the *independent* object --- that is,
> cascaded deletes flow from dependee to depender?

Yeah, cascaded deletes go backwards through the dependencies. It's a
bit like conventional versus electron flow in electronics.

> I suppose depender is an okay name, but I've got a problem with
> dependee; every time I look at one of these calls I think it's
> backwards. Can you think of a less confusing naming convention?

> All I've come up with in a short amount of time is master/slave,
> which might be considered too politically incorrect these days...

It's not accurate either. Slaves to the bidding of a master. Likewise,
children come from the parents. This really isn't either of those.

Think of a upside down pyramid scheme. A whole bunch of people at the
bottom depend upon the existence of a few below them, who depend on a
few below that, etc. Take away one of the many top elements, and the
pyramid doesn't fall. But take away the one on the bottom and the whole
thing collapses.

The dependee (those receiving the dependency from the depender) are
closer to the bottom supporting them.

The confusing part is that we deal primarily with the supporting objects
while dealing with the dependency. Perhaps better naming would be
'supporter' (dependee) and 'supportee' (depender) which reverses the
logic -- more conventional? That is, pass around the opposite of a
dependency.

I'm used to dealing with 'negative logic' -- so the current naming made
perfect sense.

Ceiling depends on the walls which depends on the floor -- or floor
supports the walls which support the ceiling. Either way, take away the
floor and you're left with a crumbled building.

Perhaps simply supporter and depender?

> I'd also like to rename dependCreate in some way that helps make
> the order of the arguments unmistakable. Perhaps dependsOn() ?
> Any thoughts?

I'm not partial to either. The change would be a simple 'rpl'.

I was considering createDependency(this, that) myself. dependsOn seems
like it should be:

this->dependsOn(that);

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-06-25 17:26:03 Re: rtree memory leak patch
Previous Message Tom Lane 2002-06-25 14:21:23 Re: several minor cleanups