All Questions
10 questions
1
vote
1
answer
214
views
Alternatives to service locator with opaque pointer in C
I have a project in which one module keeps the state of the target device (things like current command level, but mostly status registers caches).
I'm aware that having a global public variable (...
1
vote
2
answers
364
views
Is singleton the right way to go in the case of a game?
I've been reading the top posts of stackoverflow and SE and all over the place it says how bad singletons are but I am unsure how to rewrite my code.
As of now I have two projects that bind into a ...
16
votes
3
answers
25k
views
Should a DAO be singleton or not?
I am developing a RESTful API and I think it is convenient to use DAOs for my resources because although I plan on just using memory to store them, I don't want to close a door to whoever is using my ...
1
vote
1
answer
409
views
Making more than one instance of factory that is supposed to be singleton
However, there are some classes that should have only one instance.
Sometimes they are factories, which you can use to create the other objects in the system.
If more than one factory exist, ...
3
votes
1
answer
360
views
Efficient Code Design for Pattern Search Using a Singleton Pattern
I am having difficulty figuring out an efficient (thread-safe) code design for the following problem. I have been at it for some time now and would really appreciate some advice and input on how best ...
3
votes
2
answers
2k
views
Passing central objects around or having global instances? [duplicate]
Having a larger WinForms application with several classes I currently pass references to several "central" objects around to function calls.
This leads to more method parameters.
Example:
public ...
5
votes
3
answers
4k
views
Infinite loop with a singleton - does this type of issue have a name?
I ran into an unusual error while working on my project. To better learn from and remember it, I'd like to know if this type of error has a name or some definition. (The error itself OutOfMemoryError ...
0
votes
1
answer
571
views
Singleton: Why is a global point of access bad? [duplicate]
Most people here and on StackOverflow agree that Singletons are evil.
The main explanation I've come across against the use of Singletons, is they fact that they provide a global point of access to ...
4
votes
2
answers
4k
views
null values vs "empty" singleton for optional fields
First of all I'm developing a parser for an XML-based format for 3D graphics called XGL.
But this question can be applied to any situation when you have fields in your class that are optional i.e. the ...
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/...