Re: Stolen Ideas

[prev] [thread] [next] [Date index for 2004/08/10]

From: Perrin Harkins
Subject: Re: Stolen Ideas
Date: 23:23 on 10 Aug 2004
On Tue, 2004-08-10 at 18:58, Scott McWhirter wrote:
> Tony Bowden wrote:
> > On Tue, Aug 10, 2004 at 09:42:37PM +0100, Scott McWhirter wrote:
> > 
> >>The essential difference is that you're not loading the objects on the 
> >>many side as a set (even if there is just one element in the set), 
> >>instead you just get the one that you want. Tangram has these features.
> >>Hope that clears it up for the simpletons, etc.
> > 
> > 
> > I think I'm being extra simple tonight as I still don't get this.
> > 
> > Class::DBI already lets you restrict a has_many:
> > 
> >   Music::Artist->has_many(cds => 'Music::CD');
> >   my @cds = $artist->cds(year => 1980);
> > 
> > What does the other stuff give over this?
> 
> What it gives you, quite simply is a UNIQUE result for the access per
> key or index - not a list as @cds, - just one - this is what a hash does
> - one item for each key, and an Array has one item for each index.
> Reassigning to the key or index REPLACES the value. This is seemingly
> small difference has fairly profound programming implications - if you
> think about it - this is precisely what makes hashes and arrays such
> usefull data types. (my $cd = $artist->{'cds'}{'thisONEhere'};)

This only makes sense when there is a mapping table.  I hope you won't
mind if I include something from an e-mail you sent just to me:

> Okay... say for example... $supplier1 and $supplier2 have $cd.
> $supplier1 has the code "CD00001" for $cd, but $supplier2 has
> "MUS0001" for $cd. So,
> where do these codes go? Yes, it requires a mapping table, it must be 
> admited, but then you'd be able to do crazy things like:
>     my $cd = $supplier1->{'cds'}{'CD00001'}
> and be able to iterate of the keys of that hash, etc.

You can already basically do this.

Supplier->has_many(cds => [ SupplierCD => 'cd' ]);
SupplierCD->has_a(cd => CD);

my ($cd) = $supplier1->cds( code => 'CD00001' );

See the many-to-many section of the docs for details.  You would need to
set up that mapping table as a class though.  When many-to-many is
better supported, that may be unnecessary.  Making "code" implicit might
be trickier.

>  I believe that the 
> rationale behind a lot of this stuff
> is that you should store object information within the table of the 
> class and not information about an
> objects relationships.

I'm not sure what you mean by this.  In the example above, the code is
definitely an attribute of the relationship.

- Perrin

(message missing)

Stolen Ideas
Tony Bowden 18:58 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 19:03 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:06 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 19:08 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:11 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 19:19 on 10 Aug 2004

RE: Stolen Ideas
Thomas, Mark - BLS CTR 19:11 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:27 on 10 Aug 2004

Re: Stolen Ideas
Nelson C. T. Ferraz 15:14 on 12 Aug 2004

Re: Stolen Ideas
Scott McWhirter 19:18 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:28 on 10 Aug 2004

Re: Stolen Ideas
Scott McWhirter 20:42 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 21:08 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 21:33 on 10 Aug 2004

Re: Stolen Ideas
Scott McWhirter 22:58 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 23:23 on 10 Aug 2004

Re: Stolen Ideas
Gregory P. Smith 19:55 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 20:02 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 21:47 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 22:23 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:37 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 22:57 on 10 Aug 2004

Re: Stolen Ideas
Yuval Kogman 15:39 on 11 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:02 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 22:11 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:25 on 10 Aug 2004

Re: Stolen Ideas
Tim Bunce 08:53 on 24 Aug 2004

Re: Stolen Ideas
Perrin Harkins 22:16 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:42 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:16 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 23:18 on 10 Aug 2004

Re: Stolen Ideas
Scott McWhirter 23:48 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 00:22 on 11 Aug 2004

Re: Stolen Ideas
Perrin Harkins 03:45 on 11 Aug 2004

Re: Stolen Ideas
Tony Bowden 08:36 on 11 Aug 2004

Re: Stolen Ideas
Aaron Trevena 19:05 on 13 Aug 2004

Re: Stolen Ideas
Aaron Trevena 17:13 on 15 Aug 2004

Re: Stolen Ideas
Dan Friedman 04:47 on 11 Aug 2004

Re: Stolen Ideas
Tony Bowden 08:39 on 11 Aug 2004

Re: Stolen Ideas
Branislav Zahradnik 15:21 on 11 Aug 2004

RE: Stolen Ideas
Thomas, Mark - BLS CTR 19:13 on 13 Aug 2004

Re: Stolen Ideas
Tony Bowden 23:16 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 23:42 on 10 Aug 2004

Re: Stolen Ideas
Tim Bunce 08:48 on 24 Aug 2004

Re: Stolen Ideas
Tony Bowden 21:57 on 11 Aug 2004

Re: Stolen Ideas
Simon Cozens 09:03 on 24 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52