- #1
- 162
- 203
I find that any entities that act as a shared resource tend to be designed as a singleton.
My questions and answers are
Q: Can I just expose that object with simple static properties and static methods but without making it a singleton i.e its constructor is still public ?
A: Yes, but I am going to lose its rigidity of use and would probably be error-prone to threading.
Q: Can I apply multi-threading to eliminate read-write accesses to the shared object
properties, which I won't need the singleton design then ?
A: Given a web based application that millions of end-users will send back and forth their requests all the time, what do you think the probability that your likely "multi-threaded" design won't cause any problems would be instead of applying a well known pattern ?
I can't think up anymore questions and answers
. But I would like to split hairs about this. Please offer some insights and constructive guidance, I am appreciative of your inputs. :w
My questions and answers are
Q: Can I just expose that object with simple static properties and static methods but without making it a singleton i.e its constructor is still public ?
A: Yes, but I am going to lose its rigidity of use and would probably be error-prone to threading.
Q: Can I apply multi-threading to eliminate read-write accesses to the shared object
properties, which I won't need the singleton design then ?
A: Given a web based application that millions of end-users will send back and forth their requests all the time, what do you think the probability that your likely "multi-threaded" design won't cause any problems would be instead of applying a well known pattern ?
I can't think up anymore questions and answers

