Aug 17 2009 in Software Architect

Thoughts on Singleton Design Pattern – Good Bad Ugly




-- Sponsored Ads -- 



Singleton patternis one of the best-known patterns in software engineering. Essentially, a singleton is a class which only allows a single instance of itself to be created, and usually gives simple access to that instance. Most commonly, singletons don’t allow any parameters to be specified when creating the instance – as otherwise a second request for an instance but with a different parameter could be problematic. (if the same instance should be accessed for all requests with the same parameter, the factory pattern is more appropriate. )

  1. Why Singletons are Evil – While I did not write this, I totally agree with it. Brian Button is probably one of the most talented people I know, and I am sure he would love your feedback.
  2. We Don’t Need No Stinking Singletons: Why to Avoid the Singleton Pattern – OOP Techniques for Flash and Flex Developers
  3. Singletons vs. Static Classes – My last post seemed to elicit a good number of interesting responses. Today, I’m musing about Singletons vs. Static Classes — two constructs which appear to accomplish the same task. Or do they?
  4. Design Patterns – Singleton Pattern – A quick look at Singleton Pattern
  5. Chill out on the Singleton Fetish – ALT.NET dotnet .NET C# Agile BizTalk ASP.NET
  6. Know your design tools – The Singleton case – A professional software designer is one whose next paycheck depends on the quality of her software – looks for an ever increasing acquaintance with his design tools. One of the most important design tools in software is the actual computing machine is abstract,
  7. Exploring the Singleton Design Pattern – Exploring the Singleton Design Pattern
  8. Singleton – the most overused pattern. – Do you wonder why singleton is overused?
  9. The Singleton Pattern Revisited – A fresh look at Singleton Design Pattern
  10. Singletons – we are better off without them – Why we should avaoid it.
  11. Double-checked locking and the Singleton pattern – All programming languages have their share of idioms. Many are useful to know and use, and programmers spend valuable time creating, learning, and implementing them. The problem is that some idioms are later proven not to be all that they were purported, or to simply not work as described. Double-checked locking is one such idiom in the Java programming language that should never be used. In this article, Peter Haggar examines the roots of the double-checked locking idiom, why it was developed, and why it doesn’t work.
  12. Singleton pattern – At Wikipedia, the free encyclopedia
  13. Singleton pattern in MultiThreaded Environment – A Journey Through the Minds of EBW Thought Leaders for dealing with issues caused due to Singleton in Multithreaded implementations

-- Sponsored Ads -- 



Singleton pattern is: make all the methods as static, if for any reason you cannot make all the methods as static, then go for static instance approach. I feel keeping all methods as static methods is better design and developer friendly.

Share This Post

This post was tagged with the following: , , , , , , ,

Use the forms below to leave a comment. Name and e-Mail are required. e-Mail is never shared.

You must be logged in to post a comment.