You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Eric Dobbs <er...@dobbse.net> on 2003/09/09 22:20:29 UTC

drop the singleton pattern (was Re: Need to deprecate services in T2.3?)

On Tuesday, September 9, 2003, at 10:06 AM, Henning P. Schmiedehausen 
wrote:

> This actually poses an interesting question: Shall the avalonized
> services have the "singleton" lifecycle pattern just as our services
> or should it be possible to request components multiple times creating
> multiple instances (and running into possible trouble).

My take is this:

Singleton pattern is basically an object version of global
variables.  Same goes for static methods, only less object like.

There are vanishingly few cases where singleton is really
necessary or appropriate.  There are cases, and there may even
be some among the turbine/fulcrum services, but I would prefer
to see the singleton pattern dropped while moving to Avalon.  In
fact, this is one of the benefits of making that move.  It will
probably expose some assumptions, but the code will be better
for getting away from singletons.

Having said that, I still don't have much time to offer to
help.  So if no one volunteers to bite that particular bullet,
I won't complain about it too loudly.  ;-)

-Eric