Time Changes

by in CodeSOD on

Dates and times are way more complicated than we usually think they are, especially when we're talking about historical dates and times. The solution, of course, is to always use someone else's work, whether it's a library or your language's built-ins, never implement date handling yourself.

For a long time, though, Java's date handling left something to be desired. Which is why Sven found this history lesson in his company's code base:

Phoning One In

by in Error'd on

Many years ago, at the height of the Industrial Revolution, the United States was criscrossed by a riot of regional railroads. Gradually, these were acquired or merged until now there are only about a half-dozen major national railroads. In a similar fashion, at the birth of the public Internet, there must have been thousands of community Internet service providers. It seemed like every town had its own entrepeneurial enterprise, with some racks of modems in an office somewhere. Those quickly got snapped up or forced into bankruptcy, as legacy cable telecoms companies leveraged their existing monopolies into a new line of business. Which brings us to this week's Error'd. Enjoy(?) it.

First up, Adrian McCarthy grumbles "Getting help can be difficult when your regional monopoly internet service provider cannot assemble a functional web site. Note that the understandably required Description field in this online support contact form is disabled."

Tied to the Train Tracks

by in CodeSOD on

Ah, the joys of stringly typed code. Everything can be turned into a string, so why not treat everything as a string? It certainly worked for Sebastian's co-worker, who also took it to another level:

If GetTrainAtStation(aTrainNo.ToString) Is Nothing Then
    iTheTrainAtStation.Add(String.Format("{0}", aTrainNo.ToString), aTrainAtStationItem)
End If

All in the Timing

by in CodeSOD on

We like using constants instead of magic numbers. Today, we see an unusual misuse of them. It's unusual because, while it's a set of bad choices, it's not quite a `#define ONE 1` level of silliness.

First, a little background. Benjamin inherited a building automation system. This building automation system was implemented in Microsoft's Visual C++, version 6.0, way back in the 90s. As of the late 2010s, not only was it still in use, it was still pinned to the same compiler version. So not exactly the most modern of applications, but it accomplished the business goals, albeit with a lot of bugs, errors, and mysterious glitches.

Magical Destruction

by in CodeSOD on

Pretty much all object oriented languages have some concept of "destruction": objects need to release any resources they acquired at construction. In a lot of cases, we don't need to customize this terribly much, but when we do, it's vitally important to do it correctly.

Nancy's co-worker perhaps didn't understand the "correctly" part. So this was the standard pattern of C++ destructor that they wrote:

Requirements in Technicolor

by in Feature Articles on

Managing the requirements for an application is a huge challenge. The hardest part of the challenge is that, very frequently, the user's don't know what they really want or need. Prying it out of them, and giving them an application that actually solves the real problem they have, is an art.

The worst situation is when the users are absolutely certain that they do know what they want. This was the situation that Irini found herself in.


by in Error'd on

We got quite a few irregular submissions this week from regular contributors. Which is to say routine contributors. We're not qualified to make judgements about whether or not anyone is what what most folks would call normal.

First up, Isaac D. is struggling with localization, kvetching "Apparently this number format is ALIVE and WELL in parts of India and Afghanistan, but us poor Australians on desktop browsers also seem to be visually assaulted with it. I wonder if the Zuck will pay me $1,00,000 for reporting it or do real country borders mean nada in the Metaverse? ;)" This would ordinarily be controlled by some operating system or browser configuration, would it not?

The Properties of Contract Development

by in CodeSOD on

James's management had more work than they had staffing for, so they did what any company would do in that situation: expand their staff. No, of course not, I'm kidding. They bundled up a pile of work and shipped it off to the contractor who gave them the lowest bid, provided absolutely no oversight or code-quality standards in the contract, and hoped for the best.

What they got back was a gigantic pile of code that compiled. That is the only positive thing one can say about the code, because it certainly didn't work. Within a few weeks of starting reviewing the gigantic pile of garbage the contractors turned in, the dev team reached the decision that it would be quicker to rewrite from scratch than it was to try and pick apart the trashpile and reshaped the refuse into something approaching their actual requirements.