[Biojava-dev] Singletons are bad

Michael Heuer heuermh at acm.org
Wed Jul 1 16:56:36 UTC 2009


Mark Schreiber wrote:

> I came across this today which is an interesting article about how
> singletons seem like a good idea but after a while you realise they get you
> into serious trouble. After playing with BioJava for over 10 years I
> completely concur. Singletons and fly-weight objects are (IMHO) the most
> serious problem in the BioJava code base and as the article predicts the BJ
> code base is completely infected with them.
>
> The article is here:
> http://tech.puredanger.com/2007/07/03/pattern-hate-singleton/
>
>
> But I have copied the paragraph below as it seems to offer a way out without
> completely breaking everything.  This should be seriously considered for
> future BJ releases.
>
> ... paste starts here
> But I already have a bunch of singletons in my code!
> ...

I've had good luck using Google Guice in several for-work projects:

> http://code.google.com/p/google-guice/

@Inject is the new new as they say.  :)

   michael




More information about the biojava-dev mailing list