Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    you are confusing a factory with the singleton. Commented Jan 22, 2014 at 11:15
  • 1
    @amon Not really. Calendar in this example is not a singleton. Commented Jan 22, 2014 at 11:26
  • 3
    Oh, you're right. Then: that classes designer is confusing a factory with the singleton ;-) Commented Jan 22, 2014 at 11:34
  • 3
    I can't remember who said it, but... java.util.Date is a great example of how even brilliant programmers can screw up. java.util.Calendar is a testament to the fact that average programmers can screw up too. Commented Jan 22, 2014 at 11:59
  • Considered by who? I see no problem with static factory methods - they are almost always better than constructors, you can read the list of benefits in Bloch's Effective Java. Declaring one proven thing to be universally better than another is an end of career for a system architect. Commented Jan 23, 2014 at 4:48