13
User
Recs.
Recs.
2
Updates
Last
Updated
Updated
Activity
12 Options
Singletons cause an existing object to be re-used rather than created anew. While this is sometimes beneficial (opening a single shared connection to a database, for example), not having a resource or object with a clean state can be misleading - the resource could be modified from underneath you by something else deep in the function call stack that's completely unrelated.
Because singletons are typically implemented with a static variable, the problems that they create tend to apply here as well. The discussion on side effects and shared state is also relevant.
Specs
Pros
Know any positive aspects of this option?
Cons
Know any negative aspects of this option?
Recommendations
Singletons
Recommended 6 years ago
meikl hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 8 years ago
Inter hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 9 years ago
Guillaume hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 10 years ago
mas hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 11 years ago
Riyad hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 11 years ago
Jeff hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 11 years ago
Kyle hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 11 years ago
acidzombie24 hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 11 years ago
JWolfe hasn’t added their experience, pros or cons to their recommendation.
Singletons
Recommended 11 years ago
Wiske hasn’t added their experience, pros or cons to their recommendation.