On Sun, Dec 25, 2011 at 5:35 AM, Casper Bang <[email protected]> wrote:

> While singletons have been declared an anti-pattern and can probably cost
> you a job interview just for mentioning it


I'm sad to see this misconception still being bandied around, so I hereby
declare "Declaring that singleton is an anti-pattern" an anti-pattern.

Singletons are a fine and quite ubiquitous concept (you even used one in
that very message), the anti-pattern is simply to implement them with
statics. I have written more about this subject
here<http://beust.com/weblog/2011/03/10/rehabilitating-the-singleton-pattern/>
for
people interested in doing Singletons the right way.

Other than that, I agree that ServiceLocator is an unsung hero of the JDK
(I support it in TestNG so you can declare listeners in your classpath and
TestNG will automatically find them through the ServiceLocator. No need for
third party libraries).

-- 
Cédric

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to