Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    So do you mean that singletons are never eligible for use in real projects (and spotting a singleton in a real project automatically equates to code smell regardless of the use case)? Commented Jun 24, 2014 at 23:57
  • Do refrain from smelling thyself then. Your answer suggests that singletons are only used for "initial phase" code and should be factored out in all mature projects that grows bigger. So do you mean that singletons are never eligible for use in these projects, or are there valid use cases? Commented Jun 25, 2014 at 15:16
  • Very well. Singletons in real projects are a code smell, regardless of the use case and the size of the project. Using the DI pattern (with a specific container if you choose) completely negate the need for them and Singletons result in solutions that are more tightly coupled and harder to maintain in the long term. Commented Jun 25, 2014 at 19:34