CodeSOD: A Monthly Addition

Date:

Share:

In the ancient times of the late 90s, Bert worked for a software solutions company. It was the kind of company that other companies hired to do software for them, releasing custom applications for each client. Well, "each" client implies more than one client, but in this company's case, they only had one reliable client.

One day, the client said, "Hey, we have an application we built to handle scheduling helpdesk workers. Can you take a look at it and fix some problems we've got?" Bert's employer said, "Sure, no problem."

Bert was handed an Excel file, loaded with VBA macros. In the first test, Bert tried to schedule 5 different workers for their shifts, only to find that resolving the schedule and generating output took an hour and a half. Turns out, "being too slow to use" was the main problem the client had.

Digging in, Bert found code like this:

IF X = 0 THEN Y = 1
ELSE IF X = 1 THEN Y = 2
ELSE IF X = 2 THEN Y = 3
ELSE IF X = 3 THEN Y = 4
ELSE IF X = 4 THEN Y = 5
ELSE IF X = 5 THEN Y = 6
ELSE IF X = 6 THEN Y = 7
ELSE IF X = 7 THEN Y = 8
ELSE IF X = 8 THEN Y = 9
ELSE IF X = 9 THEN Y = 10
ELSE IF X = 10 THEN Y = 11
ELSE IF X = 11 THEN Y = 12
END IF
END IF
END IF
END IF
END IF
END IF
END IF
END IF
END IF
END IF

Clearly it's to convert zero-indexed months into one-indexed months. This, you may note, could be replaced with Y = X + 1 and a single boundary check. I hope a boundary check is elsewhere in this code. because otherwise this code may have problems in the future. Well, it has problems in the present, but it will have problems in the future too.

Bert tried to explain to his boss that this was the wrong tool for the job, that he was the wrong person to write scheduling software (which can get fiendishly complicated), and the base implementation was so bad it'd likely be easier to just junk it.

The boss replied that they were going to keep this customer happy to keep money rolling in.

For the next few weeks, Bert did his best. He managed to cut the scheduling run time down to 30 minutes. This was a significant enough improvement that the boss could go back to the client and say, "Job done," though it was not significant enough, so no one ever actually used the program. The whole thing was abandoned.

Some time later, Bert found out that the client had wanted to stop paying for custom software solutions, and had drafted one of their new hires, fresh out of school, into writing software. The new hire did not have a programming background, but instead was part of their accounting team.

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

Source link

Subscribe to our magazine

━ more like this

Classic WTF: Teleported Release – The Daily WTF

It's a holiday in the US today, one where we give thanks....

Bowen Yang & Matt Rogers Collab On Marshalls Gift Guide

If there’s one thing we can count on Bowen Yang and Matt Rogers for, it’s a hyper-specific pop culture reference. For the last decade,...

Best Sephora Black Friday Deals 2025

Shark FlexStyle Air Drying & Styling System ($200, originally $408)The hair tools from Shark are longtime favorites here at PS, especially the brand's Air...

Clockwise #619: I Lack the Patience For Other People

Support this show Enjoy Clockwise Unwound: Ad-free episodes and an extra Overtime topic every week. #619: I Lack the Patience For Other People August 20th, 2025 · 29 minutes Whether...