Singleton vs Proxies DP (was Re: Solution: Direct access to Printer I/O lines)

Dinu C. Gherman gherman at darwin.in-berlin.de
Sun Dec 17 21:08:41 CET 2000


Alex Martelli wrote:
> 
> I agree that unique id is part of the Singleton Pattern:
> that is what makes it problematic.  One does not really
> _care_ about that identity, only about the state and
> behavior it represents.

For me it sounds like being part of the essence of that
pattern... but you're free to disagree.

> No!  I'm not saying two clients can't hold their
> 'handles' (lw proxies) at the same time.  It IS
> pretty typical.  But it's not at all typical for client
> code to be interested in ensuring _identity_ --
> state and behavior are typical.

In the context of Singletons I would even reduce that to
state only, like with counters of some system-wide entities
of I-don't-know-what. A client is "typically" not able to
compare *bahaviour*, but state, yes. In all cases where
this comparison is difficult or time-consuming, comparing
or, probably more often in fact, *accessing* the current
state via a "globally identical" object is what a Singleton
is about - if I understood anything at all about this
pattern.

Regards,

Dinu

-- 
Dinu C. Gherman
................................................................
"The only possible values [for quality] are 'excellent' and 'in-
sanely excellent', depending on whether lives are at stake or 
not. Otherwise you don't enjoy your work, you don't work well, 
and the project goes down the drain." 
                    (Kent Beck, "Extreme Programming Explained")



More information about the Python-list mailing list