0

I've been reading about drawbacks of java.util.date for a while, but I can't understand why it is bad, that java.util.date is mutable?

Dici
  • 25,226
  • 7
  • 41
  • 82
tomdavies
  • 1,896
  • 5
  • 22
  • 32
  • 1
    For the same reason that it's bad for anything else to be mutable. Read any rant about purity by someone who's into Haskell. – Chris Martin Oct 19 '14 at 07:27
  • I would say that all the classes that represent a mathematical value or a litteral should be immutable. We want to see them as values of an abstract type, not as objects that hold a state. It is useful to reuse the same object in various computations without side-effect, or to ensure a computation will never alter the state of the objects involved. – Dici Oct 19 '14 at 07:41
  • 1
    I don't agree with the duplicate. The other question asks why Java Date API was designed this why, the current question asks why is this bad design. It is different. – Dici Oct 19 '14 at 07:43

0 Answers0