Re: tablename/guid vs. classname/guid
Torben Nehmer <[email protected]>
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, - --Piotras wrote on 2006-02-07 17:47: >> > Real example could use midgard_group and org_openpsa_organization. >> > Both types use grp table. But use different columns. >> > >> > Of course get_by_guid method shouldn't make any repligard table lookups. >> >> Ok, very well. What do you do when you move the id column of a table to a guid? > > SELECT typename from repligard , create new object instance and get_by_guid > ( the same guid used as function parameter ). Great, but now you have a problem: midgard_person Old ID 17 has GUID A openpsa_contact Old ID 17 has GUID B How do you represent this in the DB when the ID column holds the GUID? >> Wouldn't it be better to always return a "base type" (using scenario 1) and let >> the application decide what it does. > > We should have some schema stack then. ( oh, did I say stack? ;) > This forces us to make special language bindings hacks. I suspect you're talking about inheritance / extensions. Would be a good thing as we have talked about it. Although this needs serious thoughts, but it could solve the whole problem by bringing another piece of OO technology into the Schema objects. >> I see the benifits of both implementation, but I fear the side-effects of the >> possibility that a single db object has multiple guids across the types. > > I get Your point , and frankly speaking I think both scenarios are bad then. > But it also depends how classes constructors work. Well, for one thing if you stay at scenario 1 you have two cases: a) The code author knows what type he is looking for, in that case I use the correct class name anyways. b) The code works on arbitary objects, then you need the lowest common part anyway. Another thing is that you can no longer treat the various object types synonymously. When the openpsa_contact gets another guid then the midgard_person, you loose the ability to easily cast up or down between the objects. The more I think about it, the more potential problems I see when you give types sharing the same table different GUIDs. Live long and Prosper! Torben Nehmer - -- Torben Nehmer, Guenzburg, Bavaria, Germany http://www.nathan-syntronics.de, mailto:[email protected] PGP Public Key: https://www.link-m.de/pgp/t.nehmer.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFD6NF1JPh4Kn6d5FYRAr1TAJ0ert1Fwu6LFi0auDUtOAVfGkkdAQCfQB3k x+aCNVflWlkb+C4clkzribg= =6EhQ -----END PGP SIGNATURE-----