All Questions
Tagged with singleton architecture
8 questions
1
vote
2
answers
482
views
Overhead of using big singleton with all files includes
I have several subsystem managers for various uses, for example:
AudioManager
CollisionManager
InputManager
etc.
At first I wanted them to be all singletons, however now want to make the ...
9
votes
3
answers
15k
views
React Native - Is using a singleton the best alternative to DI?
I've been reading a lot about the singleton pattern and how it's "bad" because it makes the classes using it hard to test so it should be avoided. I've read some articles explaining how the singleton ...
1
vote
1
answer
347
views
HashMap to replace Singletons?
Consider the following: I have controllers and views in a client-application. As this runs purely on the client side, each controller must only exist once.
At first I thought about implementing ...
5
votes
2
answers
301
views
How to avoid a singleton in this example?
I have a class Image and another one ImageStore. The Image it's just a value object containing the package name and the image name. The ImageStore does all the actual work: calculates the real path of ...
6
votes
4
answers
4k
views
Is there something like a polymorphic Singleton?
I have a resource loader object that loads objects from the disk or from a ZIP archive, depending on the platform.
It has state (e.g. the path to the directory or the ZIP archive, and possibly some ...
4
votes
1
answer
2k
views
DAO/Webservice Consumption in Web Application
I am currently working on converting a "legacy" web-based (Coldfusion) application from single data source (MSSQL database) to multi-tier OOP.
In my current system there is a read/write database with ...
20
votes
4
answers
21k
views
Dependency Injection and Singleton. Are they two entirely different concepts?
I've been hearing about using the dependency injection over Singleton for my colleague. I still can't make out if it they are two orthogonal patterns which can be replaced with one another? Or is DI a ...
13
votes
4
answers
2k
views
Does “notification center” pattern encourage good or bad program design?
Sometimes I come across these message-hub-style APIs, for example the Cocoa NSNotificationCenter: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/...