Code Smell 32 - Singletons
29 November, 2022
5
5
0
Contributors
Problems
•
Coupling
•
Testability
•
Accidental problems
•
Multi threading
•
Premature Optimization
Solutions
1.
Avoid it.
2.
Use contextual unique objects.
3.
Benchmark object creation.
Examples
•
Database Access
•
Globals
•
Logging
Sample Code
Wrong
Right
Detection
Tags
•
Conclusion
Relations
More Info
Credits
The Diagram is Not the Model. The model is not the diagram. It is an abstraction, a set of concepts and relationships between them.