Common Calendrical Fallacies
yourcalendricalfallacyis.com
yourcalendricalfallacyis.com
A great example:
>It is normal that the Sept-, Oct-, Nov-, and Dec- months are numbered 9, 10, 11, and 12
>False. This is very weird. They used to be months 7, 8, 9, and 10, but some reform to the Roman calendar back in the day resulted in the creation of January and February, which messed everything up.
No software project cares what the calendar looked like during the roman empire. Sure, its quirky that OCTober is month 10 instead of 8. Doesn't affect anything at all.
> The current year is 2020
> False. It’s the year 5780 in the Hebrew calendar.
Obviously, anyone who says "the current year is 2020" is talking about the Gregorian calendar that everyone is familiar with. If your wife asked to have dinner at 7pm, are you going to scold her for not specifying the implied UTC offset? Its silly to even bring up.
That said, I will never willingly write code that deals with times / calendars.
Archeologists must spend a lot of time reconciling different calendars and all the changes that have happened over the years.
And yeah, if I go the rest of my career never having to work with calendars or scheduling I'll be a happy man.
And I mean, the site is about calendrical fallacies, I expected a scolding for my preconceived notions on dates and times going in.
I don't think so, but even if it does, I know some folks that could read this. Plenty of folks I work with build reports that modify times in ways that are incomprehensible. Even the Olympics can't get their online schedule right: Change to "my time," and the times may be right, but most of the days are still wrong for me.
This one in particular rubbed me the wrong way. But if it were rewritten as something like
"Don't forget about February, which is normally 28 days, unless it is a leap year in which it case it is 29 days long. But did you know that if the year is divisible by 100, we skip the leap day? Unless the year is also divisible by 400, in which case, we DO include the leap day. So even the exception has exceptions."
Or something like that. Adds a little more detail on top of what is fairly obvious.
I agree in that I don't like the snark but this one fact bugs me more than people can possibly empathize with. Once I realized October should be the eighth month, switch was permanently flipped in my brain and now I type 8 for October and it trips me up constantly.
Look, I get that calendar reform isn't easy. But the old months were all clearly named after numerical sequences. Why would the Romans intentionally break the numbering?!?!
Maybe. Maybe they're using a different calendar where the current year is actually 2020. The current year is 2565 in the Thai calendar. Putting "๒๕๖๕ กิโล, 2565 กิโล" into Google Translate to translate Thai into English results in "2022 kilometers, 2022 kilometers", because it treats the numbers as years and tries to helpfully convert them to Gregorian. Fun!
I take your main point, but its relevance is at least somewhat more recent than the Roman Empire: I've seen engraved statuary that's only a few hundred years old, in France, that used abbreviations like "VIIbre" for "septembre". Still not of direct interest to a software project probably but in recent enough history that you might interact with it in scanned archive data.
Agreed. It would have been much more useful if the article was upfront about its intent, rather than stating it in the last paragraph along with categorizing the potential pitfalls in writing such code (e.g. time, international, cultural, historic, etc.).
The categorizing is important since most, if not all, of the cases will be relevant in some circumstances and not in others. A day planner may need to consider international variation, you may need to consider leap seconds in log files, while historic and cultural variations is useful for some planetarium software.
Unless you're doing astronomy:
* https://stellarium.org/doc/0.21/classJulianCalendar.html
* https://en.wikipedia.org/wiki/Julian_year_(astronomy)
* https://en.wikipedia.org/wiki/Julian_day
* https://squarewidget.com/julian-day/
> There is also a Julian date commonly used in astronomy, which is a serial date system starting on January 1, 4713 B.C.E.
* https://support.microsoft.com/en-us/office/insert-julian-dat...
https://en.m.wikipedia.org/wiki/Old_Style_and_New_Style_date...
Context always matters.
Which is why we have (or should have) Domain Boundaries. Within which we have (or should have) ubiquitous language. And within wich our deliberate assumptions always hold true.
More practical, this is one reason why you want to isolate dependencies behind an anti-corruption layer, or some adapters or whatever architecture to isolate. It isolates your internal context, where it is fine to assume 2020 is western calendar and not the Thai calendar (where the current year is 2565, and used by some hundred million potential customers). Eventhough the library you use may deal with all those intricacies, within your domain, you deliberately don't.
These problems are solved. Eric Evans wrote a fantastic book (DDD) explaining how it has been solved, 18 years ago. We must keep bringing such problems up. But we should try to avoid inventing solutions again and again.
And we should certainly avoid giving up, and saying this silly, unsolvable or Just Too Hard™.
So I think instead of "scolding" the reader with a False here, maybe a Depends would be both more friendly and more well suited.
I like this. False suggests it is objectively false, but you're right, it really depends on more information. And it's important that people working with dates and times understand that they need more information.
The point however is that every dev sometimes needs to make assumptions about an calendar — even those who are smart enough not to write their own calendar. E.g. if you think about a typical fitness tracker of course the devs will have to make assumptions about weeks and months, instead of supprting every calendar under the sun.
This is why a Depends makes a lot more sense here: Knowing that it exists is good, but you might not have to support it in an 1.0 release
It's a blog post, how can a "false" make you feel scolded?
If it is false only if you pinch hard and look from the right angle it comes of as "Oh come on, you just don't want me to get this right" — which in this case runs counter to the whole idea of the blog post as I understood it.
I had a teacher once who was like that: whenever someone he didn't like got something wrong he would pull out some pedantic detail to still make it look like the person was false, even though they really really were not. I kinda think this is just a little bit unproductive in an educational context.
I get whiplash going back and forth between "relevant thing I need to care about" and "obviously irrelevant" in this list
yourcalendricalfallacyis.com should have categories. General > Generic Programming > language specific
I've made many mistakes attributable to "tomorrow" switching at midnight according to computers when in common human usage "tomorrow" really switches closer to sunrise, and certainly not before one goes to bed unless one is staying up all night.
Well, obviously using `00:00:00` as no-time is a terrible idea, but isn't that statement just wrong? If it's used to represent no-time, it would actually have a very low chance of doing what it's supposed to do in those countries, but fail all the time at all other time zones.
False, the current year according to the Grogorian calendar is 2022.
Disappointing an article as pedantic as this one fails itself. (Yes, I am aware it was likely written in 2020. That is the point: it assumed the reader read it in 2020.)
It was a painful experience but it aught me a valuable lesson. To this day I would sooner write my own bootloader than roll my own date/time library.
I've seen a number of "Falshoods programmers believe about X" and they almost never provide examples or explanations, which is rather frustrating for some of the more obscure or weird cases.
Spring: March April May
Summer: June July August
Fall: September October Novmeber
Winter: December January February
I define it as a period of time between a equinox and a solstice.
If it didn't get colder than fall than it would be possible to skip winter.
In part. I'd say it's a combination of the temperature and amount of light you get per day.
When is it "night"? At what exact moment in time does it become "night"? Nobody knows, nobody cares. It's still a useful concept.
I have found NSDate/NSCalendar to be the best designed API for date and time calculations, and I never knew it was built on top of ICU. It discourages bad assumptions while many others try to make a more 'fluent' interface that encourages them.
When I first tried Joda in Java it had a builder interface that stank, I was able to easily write tests that produced the wrong date or threw an exception simply by changing the order of construction. But I think that's long gone.
~ Events always start and end on the same day
~ Any event has a start and end time
~ All events are on a specific day
> The current year is 2020
> False. It’s the year 5780 in the Hebrew calendar.
Like an Easter egg.