[Zope-dev] RE: Object references

Jason Spisak webmaster@mtear.com
Wed, 12 May 1999 13:10:51 -0400


Robert,

<opinion>
I was tossing that same problem around before I said yes to the Catalog
and ZClasses.  I went with the them because the structure I have is
mostly Hirearchicle in nature.  I do however have two objects that store
a referring object's id as a property. I have submission objects that
contain a reference to a person object that was sent.  I do a DTML 
_.getattr(_.getitem()) call to get the piece of the person object I want
to grab in reference to that submission, or a  (off the top of my head
untested )
<!--#if person-->
<!--#with People_Folder-->
<!--#var "_[_['person']]"-->
<!--#/with-->
<!--#/if-->

and that renders the actual document stored in the person property.(I
have gloablly unique id's for ZClass instances) That's all fine and
good, it can be done, but when you delete the object stored in that
property, Zope will not be able to find it, true, and ugly.  

I thought of two ways to check that effect a) write DTML to display only
if the id is valid b) write a method that takes place when you delete a
ZClass instance that does a quick Catalog search and update that
replaces it with whatever value you want.  Even ORACLE 8 has to clean up
after itself in this way if you use its new REF sql construct.  But they
wrote it so you have to pay for it and don't even know what it does.

Funny thing is that if you are keeping around old copies of something
that refers to objects that no longer exsist, the instance itself no
longer has to be dynamic, it is history.  So preserving thier dynamic
nature does nothing for you. The Order Class is only applicable when
it's dynamic, and a subclass or whatever, more accurately depicts the
order after the purchase has cleared and can't change anymore. After
paid, then the order ceases to be an Dynamic Order and becomes a Static
Order.  Static orders could just be a DTML method with some proerties.
It's history. You're only keeping it around so that you can say who
bought what when, etc...

This is all just the way that I did things here, and it probably only
applies to me, but I thought I'd give my thoughts such as they are. To
be honest, I'd contort my ususal way of doing things just to have the
speed, ease of use, flexibility, and extendability the Zope offers.  I
weighed all the possibilities on the scale of Web Applications and Zope
came out the winner. Everyone has thier own scales.

</long, way too long, opinion>;-)

All my best,

-- 
Jason Spisak
webmaster@mtear.com