<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Singleton implementations</title>
	<atom:link href="http://www.shaunabram.com/singleton-implementations/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaunabram.com/singleton-implementations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=singleton-implementations</link>
	<description>Java and Technology weblog</description>
	<lastBuildDate>Sun, 05 Feb 2012 22:00:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: admin</title>
		<link>http://www.shaunabram.com/singleton-implementations/comment-page-1/#comment-11367</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 05 Apr 2010 00:59:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=809#comment-11367</guid>
		<description>Hey,
I agree that singletons can be &#039;bad&#039; - I did say in my intro that I consider the singleton to be an anti-pattern that makes unit testing very difficult. And, yes Dependency Injection can be a great approach (I have given talks on Spring).

The article is about what Singleton implementations are best if you want/have to use them, not if Singletons are a good idea. And, all things considered, the enum solution ticks all the boxes: thread safe, lazy instantiation and protection against serialization issues without the need for complicated work arounds. They are also the approach advocated by Josh Bloch, the author of the Collections API. I highly recommend you read his book, Effective Java.

So, I guess the question to you is: If you are going to use a Singleton, why do you think the enum approach is bad?

Shaun</description>
		<content:encoded><![CDATA[<p>Hey,<br />
I agree that singletons can be &#8216;bad&#8217; &#8211; I did say in my intro that I consider the singleton to be an anti-pattern that makes unit testing very difficult. And, yes Dependency Injection can be a great approach (I have given talks on Spring).</p>
<p>The article is about what Singleton implementations are best if you want/have to use them, not if Singletons are a good idea. And, all things considered, the enum solution ticks all the boxes: thread safe, lazy instantiation and protection against serialization issues without the need for complicated work arounds. They are also the approach advocated by Josh Bloch, the author of the Collections API. I highly recommend you read his book, Effective Java.</p>
<p>So, I guess the question to you is: If you are going to use a Singleton, why do you think the enum approach is bad?</p>
<p>Shaun</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Random Fletch</title>
		<link>http://www.shaunabram.com/singleton-implementations/comment-page-1/#comment-11366</link>
		<dc:creator>Random Fletch</dc:creator>
		<pubDate>Sun, 04 Apr 2010 23:12:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=809#comment-11366</guid>
		<description>Woah, I kept trying to find the date to work out if this was an April fools. Dude, Singletons are bad enough. Wrapping them up in an Enum makes them even scarier.

Dependency Injection is your friend.</description>
		<content:encoded><![CDATA[<p>Woah, I kept trying to find the date to work out if this was an April fools. Dude, Singletons are bad enough. Wrapping them up in an Enum makes them even scarier.</p>
<p>Dependency Injection is your friend.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

