[Zope-CMF] Dublin Core

Tres Seaver tseaver@palladion.com
Thu, 14 Jun 2001 18:13:37 -0400


Shane Hathaway wrote:

> On Thu, 14 Jun 2001, Tres Seaver wrote:
> 
> 
>>An aspect bag is a proposed interface for content, to allow tools and
>>services to "stash" opaque data about a content object "on" the
>>object (it is opaque to the content object).  The name comes from aspect-
>>oriented programming, which focused on "weaving" new behavior onto
>>relatively "dumb" objects.  This interface will provide a cleaner
>>mechanism than just sticking things (like metadata, workflow history,
>>and discussions) directly into the object's dictionary.
>>
> 
> As I see it, it is part of the contract of PortalContent to support
> specifically the talkback, workflow_history, and now metadata attributes.
> The only difference in implementing aspects this new way is that there is
> one opaque attribute instead of several (very specific attributes, I
> might add).  Is there any other difference?


PortalContent should *not* have this as part of its contract;  if
it can implement AspectBag, then services will be free to extend
similar implementations without requiring any changes to PortalContent.

Imagine an interface:

   from Interfaces import Base

   class AspectBag( Base ):
       """
           Hold aspects (opaque tokens, viz Memento patter in Gof)
           on behalf of the service objects with which we collaborate
           (e.g., workflow, metadata, etc.)
       """
       def getAspect( service_object ):
           """
               Return the aspect we are holding, if any, for
               'service_object'  (we should probably validate
               that 'service_object' is registered as a service).
           """

       def setAspect( service_object, aspect ):
           """
              Stach 'aspect' on behalf of 'service_object'
             (we should probably validate that 'service_object'
              is registered as a service).
           """

Writing an adapter which fits *this* interface onto an arbitrarily
dumb content object is much simpler and cleaner than one which must
be extended for each service which, now or in the future, needs to
use aspects (having started with one, discussions, we have added
workflow history, and are considering metadata;  others will be
coming).

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org