in reply to How to implement set-style membership lists in my obejcts

It seems to me that you're trying to force the inheritance nature of things a bit too much.

Ordinarily, sub-classing is an "is-a" relationship (a 'Dog' is-a 'Animal'). I wouldn't say that a User is-a Site. This is more properly a 'has-a' relationship. (A Site has Users). Other than that, Site and User are unrelated (neither inherits from the other).

RDBMSs can happily and efficiently express has-a relationships, and there are ORM wrappers to allow you to do this in perl. I don't have a particular recommendation, but reading the docs for Class::DBI might give you a fresh perspective, and others might chime in with advice.

So I'd say: "Don't try to force your data into a purely hierarchical system if it isn't, and don't try to model all hierarchical relationships as OO inheritance."

  • Comment on Re: How to implement set-style membership lists in my obejcts

Replies are listed 'Best First'.
Re^2: How to implement set-style membership lists in my obejcts
by clinton (Priest) on May 16, 2007 at 12:19 UTC
    I wouldn't say that a User is-a Site.

    Sorry, a misunderstanding, I wasn't saying that User subclasses Site, but rather that user:123 has the parent Site:1.