Hash: SHA1

Lennart Regebro wrote:
> On Tue, Dec 1, 2009 at 01:16, Gary Poster <gary.pos...@gmail.com> wrote:
>> I don't love "singleton."  I think it is better than "utility."  I agree at 
>> least that it probably isn't better enough to introduce confusion.  I'd be 
>> more insistent on "singleton", or finding a better term than either of them, 
>> if this were a fresh API.
> I wonder if the best isn't to make the documentation clearly say
> "Utilties are singleton components that can be looked up per
> interface".

+1 to improving the documentation.

- -1 to using the term "singleton".  The term is loaded up with things
that aren't relevant to what utilities do:  in particular, there is no
requirement / promise that the object registered as a utilitiy is an
instance of a class, much less that its class / module jumps through
hoops to guarantee that only one instance can exist[1].  The promise is
merely that the object returned from the lookup will provide the given
interface:  no more, no less.

I have often registered functions as utilities, for instance, where the
contract of the corresponding interface was just that it be callable
with a given signature.  I even recall registering a module as a
utility, although I can't find the example at the moment.

"Global objects" is a more accurate description of the things registered
as utilities from ZCML / imperative code:  even that term is inaccurate
once persistent objects get registered.

[1] See the description of the Singleton pattern in the
    mother-of-all-wikis: http://www.c2.com/cgi/wiki?SingletonPattern

- --
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to