STEPHEN GLOVER: How supine Labour is in its dealings with China. And what a scandal if they have compromised our security to keep our new masters happy
Illinois Governor JB Pritzker says Trump to deploy 400 National Guard troops from Texas to 'invade' liberal states
Angela Merkel says Poland and the Baltic states are responsible for Putin's war in Ukraine
PM's national security chief could be held in contempt of Parliament if he refuses to appear before committee over China spy scandal after Commons espionage case collapses
Techie found an error message so rude the CEO of IBM apologized for it
Who, Me? Oh, bother, it's Monday. But rather than curse about another working week rolling around, The Register welcomes it with another instalment of Who, Me? It's the reader-contributed column in which you confess to workplace whoopsies and reveal how you survived them.…
CodeSOD: A Monthly Addition
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 IFClearly 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.
Princess Beatrice's navy broderie blouse is in high demand - but luckily it's available in white too
Revealed: Queen Elizabeth II's final state visit that perfectly encapsulated her subtle influence
Party membership falls as Tory clan gathers: ANDREW PIERCE
QUENTIN LETTS: Kemi Badenoch stood there, small, still, musing in that smoky voice... not shouting like a larky fake
Foreigners will be BANNED from claiming benefits under Tory plans to save £50billion
My wife is due a full state pension so why does HMRC want £179 more in National Insurance?
Massive 1,200lbs beast with broken jaw is crowned Fat Bear Week winner
What Happens When AI Directs Tourists to Places That Don't Exist?
Read more of this story at Slashdot.