The Map to Your Confession
by in CodeSOD on 2025-11-25Today, Reginald approaches us for a confession.
He writes:
Today, Reginald approaches us for a confession.
He writes:
Part of the "fun" of JavaScript is dealing with code which comes from before sensible features existed. For example, if you wanted to clone an object in JavaScript, circa 2013, that was a wheel you needed to invent for yourself, as this StackOverflow thread highlights.
There are now better options, and you'd think that people would use them. However, the only thing more "fun" than dealing with code that hasn't caught up with the times is dealing with developers who haven't, and still insist on writing their own versions of standard methods.
Sometimes, it's hard to know just when you are. This morning, I woke up to a Macbook that thinks it's in Paris, four hours ago. Pining for pain chocolate. A bevy of anonyms have had similar difficulties.
First up, an unarabian anonym observes "They say that visiting Oman feels like traveling back in time to before the rapid modernization of the Arab states. I just think their eVisa application system is taking this "time travel" thing a bit too far... "
Someone wanted to make sure that invalid routes logged an error in their Go web application. Artem found this when looking at production code.
if (requestUriPath != "/config:system") &&
(requestUriPath != "/config:system/ntp") &&
(requestUriPath != "/config:system/ntp/servers") &&
(requestUriPath != "/config:system/ntp/servers/server") &&
(requestUriPath != "/config:system/ntp/servers/server/config") &&
(requestUriPath != "/config:system/ntp/servers/server/config/address") &&
(requestUriPath != "/config:system/ntp/servers/server/config/key-id") &&
(requestUriPath != "/config:system/ntp/servers/server/config/minpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/config/maxpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/config/version") &&
(requestUriPath != "/config:system/ntp/servers/server/state") &&
(requestUriPath != "/config:system/ntp/servers/server/state/address") &&
(requestUriPath != "/config:system/ntp/servers/server/state/key-id") &&
(requestUriPath != "/config:system/ntp/servers/server/state/minpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/state/maxpoll") &&
(requestUriPath != "/config:system/ntp/servers/server/state/version") {
log.Info("ProcessGetNtpServer: no return of ntp server state for ", requestUriPath)
return nil
}
Today's representative line comes from Capybara James (most recently previously). It's representative, not just of the code base, but of Goodhart's Law: when a measure becomes a target, it ceases to be a good measure. Or, "you get what you measure".
If, for example, you decide that code coverage metrics are how you're going to judge developers, then your developers are going to ensure that the code coverage looks great. If you measure code coverage, then you will get code coverage- and nothing else.
One of the things that makes legacy code legacy is that code, over time, rots. Some of that rot comes from the gradual accumulation of fixes, hacks, and kruft. But much of the rot also comes from the tooling going unsupported or entirely out of support.
For example, many years ago, I worked in a Visual Basic 6 shop. The VB6 IDE went out of support in April, 2008, but we continued to use it well into the next decade. This made it challenging to support the existing software, as the IDE frequently broke in response to OS updates. Even when we started running it inside of a VM running an antique version of Windows 2000, we kept running into endless issues getting projects to compile and build.
Robert R picked up a bug in his company's event scheduling app. Sometimes, events were getting reported a day off from when they actually were.
It didn't take too long to find the culprit, and as is so often the case, the culprit was handling dates with strings.