How About Next Month
by in CodeSOD on 2024-03-18Dave's codebase used to have this function in it:
public DateTime GetBeginDate(DateTime dateTime)
{
return new DateTime(dateTime.Year, dateTime.Month, 01).AddMonths(1);
}
Dave's codebase used to have this function in it:
public DateTime GetBeginDate(DateTime dateTime)
{
return new DateTime(dateTime.Year, dateTime.Month, 01).AddMonths(1);
}
Rui recently pulled an all-nighter on a new contract. The underlying system is… complicated. There's a PHP front end, which also talks directly to the database, as well as a Java backend, which also talks to point-of-sale terminals. The high-level architecture is a bit of a mess.
The actual code architecture is also a mess.
Branon's boss, Steve, came storming into his cube. From the look of panic on his face, it was clear that this was a full hair-on-fire emergency.
"Did we change anything this weekend?"
Donald was cutting a swathe through a jungle of old Java code, when he found this:
protected void waitForEnd(float time) {
// do nothing
}
FreeBSDGuy sends us a VB .Net snippet, which layers on a series of mistakes:
If (gLang = "en") Then
If (item.Text.Equals("Original")) Then
item.Enabled = False
End If
ElseIf (gLang = "fr") Then
If (item.Text.Equals("Originale")) Then
item.Enabled = False
End If
Else
If (item.Text.Equals("Original")) Then
item.Enabled = False
End If
End If
Today, John sends us a confession. This is his code, which was built to handle ISO 8583 messages. As we'll see from some later comments, John knows this is bad.
The ISO 8583 format is used mostly in financial transaction processing, frequently to talk to ATMs, but is likely to show up somewhere in any transaction you do that isn't pure cash.
Today's submitter identifies themselves as pleaseKillMe, which hey, c'mon buddy. Things aren't that bad. Besides, you shouldn't let the bad code you inherit drive you to depression- it should drive you to revenge.
Today's simple representative line is one that we share because it's not just representative of our submitter's code base, but one that shows up surprisingly often.
It's a nearly universal experience that the era of our youth and early adulthood is where we latch on to for nostalgia. In our 40s, the music we listened to in our 20s is the high point of culture. The movies we watched represent when cinema was good, and everything today sucks.
And, based on the sheer passage of calendar time, we have a generation of adults whose nostalgia has latched onto Flash. I've seen many a thinkpiece lately, waxing rhapsodic about the Flash era of the web. I'd hesitate to project a broad cultural trend from that, but we're roughly about the right time in the technology cycle that I'd expect people to start getting real nostalgic for Flash. And I'll be honest: Flash enabled some interesting projects.