3 ms·
If I can, I never use the classical singleton pattern because of testability. On the other hand I use one single instance of a class if I can make use of a depe
by chopin 6y ago
If I can, I never use the classical singleton pattern because of testability. On the other hand I use one single instance of a class if I can make use of a dependency injection framework. I prefer that over static classes which have the bad habit of getting in the way of testing.