Waiting for October – The Daily WTF

Date:

Share:

Arguably, the worst moment for date times was the shift from Julian to Gregorian calendars. The upgrade took a long time, too, as some countries were using the Julian calendar over 300 years from the official changeover, famously featured in the likely aprochryphal story about Russia arriving late for the Olympics.

At least that change didn’t involve adding any extra months, unlike some of the Julian reforms, which involved adding multiple “intercalary months” to get the year back in sync after missing a pile of leap years.

Speaking of adding months, Will J sends us this “calendar” enum:

enum Calendar
{
    April = 0,
    August = 1,
    December = 2,
    February = 3,
    Friday = 4,
    January = 5,
    July = 6,
    June = 7,
    March = 8,
    May = 9,
    Monday = 10,
    November = 11,
    October = 12,
    PublicHoliday = 13,
    Saturday = 14,
    Sunday = 15,
    September = 16,
    Thursday = 17,
    Tuesday = 18,
    Wednesday = 19
}

Honestly, the weather in PublicHoliday is usually a bit too cold for my tastes. A little later into the spring, like Saturday, is usually a nicer month.

Will offers the hypothesis that some clever developer was trying to optimize compile times: obviously, emitting code for one enum has to be more efficient than emitting code for many enums. I think it more likely that someone just wanted to shove all the calendar stuff into one bucket.

Will further adds:

One of my colleagues points out that the only thing wrong with this enum is that September should be before Sunday.

Yes, arguably, since this enum clearly was meant to be sorted in alphabetical order, but that raises the question of: should it really?

[Advertisement]
Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

Source link

Subscribe to our magazine

━ more like this

Adventures in Claude – Feld Thoughts

My obsession with Claude Code continues. Amy is now referring to Claude as my other best friend.I realized my Claude posts were taking over...

‘Nice shoes, mate’: we road test the brick-shaped £199 Lego Crocs | Fashion

Everyone knows that standing on Lego is the worst pain known to man, but standing in Lego Crocs – how bad can they be?...

Ego Ella May, Musician | Into The Gloss

“I’ve been a slow burner. I’ve always made music, but my professional career only started taking off in the last four years when I...

Waymo – From the road

Advice, not control: the role of Remote Assistance in Waymo’s operations Our mission at Waymo is to be the world’s most trusted driver, and we...