[Zope3-dev] EventService, references, and subscription semantics

Jim Fulton jim@zope.com
Wed, 27 Feb 2002 09:52:38 -0500


Jim Fulton wrote:
> 
> Steve Alexander wrote:
...
> > We might want to have a range of subscribe methods:
> >
> >    * subscribePersistentObject
> 
> Probably. There are complications with export and import,
> but exporting and imnporting event services is sufficiently
> weird to begin with that I'm not inclined to worry too much about
> it.
> 
> >    * subscribeTraversalLocation
> 
> This is probably a good idea.
> 
> >    * subscribeTransientObject    (held onto by a weak reference perhaps)
> 
> No no no.
> 
> >    * subscribeRuidObject  (for subscribing an object via an object hub)
> 
> Yes. :)
> 
> It might be possible to abstract the subscribeTraversalLocation and subscribeRuidObject
> cases. Let me think about that.

OK, here's what I think:

- The interfaces don't need to change.  

- Clients of subscribe need to be aware of reference semantics.  It's
  up to the subscription client to give a subscriber with the desired
  semantics.

  o Hard Reference 

    Simply register the subscriber directly, in which case, the
    subscription, and possibly the subscriber, is as persistent as the
    subscribable.

  o Soft reference

    Register an object with a notify method and a path that
    dereferences the path and delegates notifications.

  o Location-independent reference

    Register an object with a notify method and an ObjectHub ruid that
    dereferences the ruid via the hub and delegates notifications.

  o Abstract reference

    Register an object with a notify method and an IReference that
    dereferences the IReference and delegates notifications.

- Hard references accross persistence (or non-persistence) mechanisms
  should be considered bugs or design flaws. Subscriptions of persistence
  subscribers to FS subscribables are considered harmful.
  
In other words, let's keep things simple. YAGNI :)

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org