2007年5月17日星期四

Cameron Purdy: Useless data types: Date, Date, Time, Timestamp

Cameron Purdy, in "The Seven Habits of Highly Dysfunctional Design," promises us seven dysfunctional designs in Java, and starts with "Useless data types: Date, Date, Time and Timestamp."

He gives the history of java.util.Date (and its successor, java.util.Calendar) and shows what wasn't quite right about them, and finishes with this gem:
As far as java.util.Calendar goes, I'm sure it has a purpose, but since we've been on the Gregorian now for several friggin' centuries (and with no sign of imminent change), I think we'd be safe having Calendar be one of those classes that is neither seen nor heard except in the 0.000001% chance that you actually need to do something with the scrolls of dead monks.
Apparently those of us who do use alternate Calendars are to be left out a bit, although in all fairness, using a lunar calendar isn't supported by the JDK without external libraries in any case. :)

没有评论: