users@jersey.java.net

[Jersey] Re: What is the right way to handle threading with jersey client

From: Ryan Stewart <rds6235_at_gmail.com>
Date: Mon, 11 Jul 2011 21:21:23 -0500

What you're describing there is the singleton pattern. Singletons are also
evil: http://www.riedquat.de/prog/singletonsAreEvil

Statics (besides constants) and singleton-designed classes serve much the
same purpose and violate dependency injection, making testing more difficult
and the overall structure of an app less malleable.

That's all just my (and others') opinion, of course, but it's backed by
several years of Java experience.

On Mon, Jul 11, 2011 at 8:56 PM, Kevin Duffey <andjarnic_at_yahoo.com> wrote:

> Thanks.
>
> Not sure I agree that static is evil in all cases. I use it sometimes where
> it fits. Mostly to declare final constants, but I can agree that it's
> probably mostly out of convenience as opposed to making a class with a
> private constructor and factory creation method and make sure only one
> instance is ever created.
>
>
>