• Ephera
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 hours ago

    Well, because I’m of a very different opinion about its readability. If you know the format, then sure, you can mostly read it as expected. But our logs are often something that customers or sysadmins will want to read. If it says Retrying in PT5S... in there, they’ll think that’s a bug, rather than a duration.

    And yeah, I almost figured it was for de-/serialization. I guess, that’s something where I disagree with the designers of Java.
    In my opinion, you don’t ever want to rely on the implicit behavior of the language for your serialization needs, but rather want to explicitly write down how you’re serializing. You want to make a conscious decision and document that it’s the ISO 8601 format, so that if you need to hook up another language, you have a chance to use the same format. Or, if you need to change the format, so that you can change the one serialization function, rather than having to find all the places where a .toString() happens.

    Admittedly, the Java devs were between a rock and a hard place, due to them having to implement .toString() and the meaning of .toString() being kind of undefined, i.e. it’s never stated whether this is a format for serialization, for debugging or for displaying to the user. And then I guess, because it didn’t explicitly say “for debugging” on there, they felt it was important to go with a standard format.