Re: Dependency / Constraint patch - Mailing list pgsql-patches

From Rod Taylor
Subject Re: Dependency / Constraint patch
Date
Msg-id 1025021895.55512.37.camel@jester
Whole thread Raw
In response to Dependency / Constraint patch  (Rod Taylor <rbt@zort.ca>)
Responses Re: Dependency / Constraint patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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);




pgsql-patches by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Reduce heap tuple header size
Next
From: Tom Lane
Date:
Subject: Re: Reduce heap tuple header size