Services interfaces should not include mutators (was Re: [Zope3-dev] discussion about ObjectHub, EventService etc. (was event-meta.zcml...))

Jim Fulton jim@zope.com
Sun, 22 Dec 2002 10:54:43 -0500


Steve Alexander wrote:
> 

....

> We could have an IZopeEventService, which extends an IEventService for 
> easy use in the Zope framework.
> 
> So:
> 
>   IEventService            Generic, useable outside of Zope.
>       ^                    Not specific about how subscribe() works.
>       |
>       |
>   IZopeEventService        Extends the semantics of the subscribe()
>       ^                    method to allow subscribtion by location,
>       |                    hubId relative to ObjectHub service, or
>       |                    physically locatable object.
>       |
>       |
>   IGlobalEventService      Has special globalSubscribe() method.
>                            Disables subscribe() method.
>                            Used as the global event service.


This discussion provides yet more evidence for the rule of thumb that
service APIs should not contain mutators.

In any case, I suggest a different factoring:

- Define an event notification service that just supports event notification.

- Define a global event subscription service.

- Define a local event subscription service.

Typically, components that provide the event notification service
will provide either the global event subscription service or the local
event subscription service.

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