Christophe Verré wrote:
Why don't you just do this?
Looks like he wants to call only the methods whose name is stored in a map.
Janeice DelVecchio wrote:I never said singletons were good or bad. I just don't know. Actually, my very first post said I made no assertions whether or not they should be used or not. I said I understood the basic concept of why someone would use it over a static variable. Rather, I think I just compared the two, not even made an assertion of why it should be used over a static variable.
What I said was that no one could tell me (on a foundational level) what the heck is wrong with using them. Everyone here has said "they're bad," "don't use them," et cetera.
I got links to blog posts from several years ago. Are these people respected in the field? I have no idea. No one said, "please see Joe Shmoe's blog, he's a such and such person in the blah blah industry for x years. He did studies for blah company."
When I questioned the sources, on an academic level, no one could defend the fact that the sources were blogs. No one could find a reputable source (or at least define what makes the blogs reputable).
If someone could tell me, in normal person language:
1: Why doesn't the JDK5 "volatile label fix" work to fix the singleton problem?
2: What, if any, are the problems with the Singleton pattern, exclusive of the issue of threadsafety (which is supposedly fixed by the "volatile" labeling)
I am really through with feeling like I have to defend myself. Just because I ask questions doesn't mean I'm questioning anyone's judgement, it just means I'm not going to take advice on face value no matter how long you've been following it.
pandeyalok kumar wrote:Can anyone please suggest any way to do that.
Harshana Dias wrote:
Primitives and Object reference are store in stack right.
Mike Bates wrote:
Twiddling bits has not been easy for me so I am learning as I go. I am Googling references on this type of approach to better understand what is going on.
karthik manick wrote:As far as my perception, without abstract classes also we can use the concept of polymorphism...then why to create a abstract class and extending it?
gudim gudi wrote:
Any ideas, suggestions, resources, links, sample code highly appreciated.
Mike Bates wrote:Any thoughts?
James Clarks wrote:The infamous Simpleton design pattern is a non-object-oriented way to write "structured" procedural code. It is typically used by programmers that either do not significantly understand object-oriented design principles or are lazy buffoons that don't care about the code they write.
This pattern should never have been included in the GOF book, and was simply a bone to get individuals to start to think about patterns period.
Just me two cents
Sbt Bhatta wrote:In both Q1 and Q2, isn't the reference type is Animal ?
SO I am guessing somewhere I understood it wrong. It seems to me as if the JVM looks at the instance type during runtime/compile time. please please pretty please
Pat Farrell wrote:
While nobody should force you to use a Singleton pattern in Java, if you work for me, I'll force you to not use it, as its bad engineering.