[Zope-dev] ZPatterns framework improvements

Tres Seaver tseaver@palladion.com
Mon, 22 May 2000 12:14:14 -0400


"Phillip J. Eby" wrote:
> 
> At 03:51 PM 5/21/00 -0400, Tres Seaver wrote:
> >
> >This is really just the classic Observer pattern, a la GoF Design
> >Patterns.  "ObjectAdded" and "ObjectRemoved" are events a
> >"RackObserver" would register for;  "AfterCreate", "Changed",
> >and "BeforeDestroy" are events of the "hosted" object itself.  Note
> >that "ObjectAdded" and "ObjectRemoved" would be called during move or
> >rename operations, even though the object is not being created.
> 
> Yes, but the DataManager will filter that such that Zope "Move" and
> "Rename" operations will show to Indexing and Rule agents as though
> they were just "Change" events.  See the DataManagementEvents entry
> in the new ZPatterns Wiki for details on how this will work.

This design has the unfortunate side effect of coupling an object
tightly
to a single location.  Properly speaking, objects shouldn't "know" about
their containers;  the container should be responsible for handling any
operations which depend on it.  Consider a Unix file system:  the
command
to get rid of a file is "rm," which is an operation on the *directory*,
not
on the file/subdirectory;  it only causes the file to be deleted if the
current directory was the only one with a link to the file. 
CatalogAware
is currently broken (as Evan just pointed out to me) because it tries
too
hard to know about its container's path;  it would be better if the
container were responsible for doing the
index_object/reindex_object/unindex_object stuff, and not the object
itself.

Tres.
-- 
===============================================================
Tres Seaver       Digital Creations        tseaver@digicool.com