About 25,300,000 results
Open links in new tab
  1. What are the real world applications of the singleton pattern?

    Apr 9, 2009 · Simple. What does a singleton do? It provides global access to an instance of an object, and It guarantees that no more than one instance of that type can ever be created. So …

  2. What are drawbacks or disadvantages of singleton pattern?

    The singleton pattern is a fully paid up member of the GoF's patterns book, but it lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially for factory

  3. On design patterns: When should I use the singleton?

    The glorified global variable - becomes a gloried global class. Some say breaking object-oriented design. Give me scenarios, other than the good old logger where it makes sense to use the …

  4. Thread Safe C# Singleton Pattern - Stack Overflow

    Sep 7, 2012 · The pattern you see here is called double-checked locking. Its purpose is to avoid the expensive lock operation which is only going to be needed once (when the singleton is first …

  5. .net - How to implement a singleton in C#? - Stack Overflow

    How do I implement the singleton pattern in C#? I want to put my constants and some basic functions in it as I use those everywhere in my project. I want to have them 'Global' and not …

  6. What is an efficient way to implement a singleton pattern in Java ...

    Sep 16, 2008 · This is useful when your singleton needs to inherit from a superclass. You cannot use the enum singleton pattern in this case, since enums cannot have a superclass (they can …

  7. Simplest/cleanest way to implement a singleton in JavaScript

    What is the simplest/cleanest way to implement the singleton pattern in JavaScript?

  8. Difference between static class and singleton pattern?

    Feb 6, 2009 · What real (i.e. practical) difference exists between a static class and a singleton pattern? Both can be invoked without instantiation, both provide only one "Instance" and …

  9. .net - What is a singleton in C#? - Stack Overflow

    Jan 28, 2010 · A singleton is a class which only allows one instance of itself to be created - and gives simple, easy access to said instance. The singleton premise is a pattern across software …

  10. Implementing Singleton with an Enum (in Java) - Stack Overflow

    Oct 10, 2014 · In this Java best practices book by Joshua Bloch, you can find explained why you should enforce the Singleton property with a private constructor or an Enum type. The chapter …