Recent Articles

Dec 2024

Best of 2024: Lowering the Rent Floor

by in Best of… on
Businesses always want to save money. But boy, they can sometimes come up with some hare-brained ways of doing it. Original --Remy

Things weren't looking good for IniOil. It was the 1980s in the US: greed was good, anti-trust laws had been literally Borked, and financialization and mergers were eating up the energy industry. IniOil was a small fish surrounded by much larger fish, and the larger fish were hungry.

Gordon was their primary IT person. He managed a farm of VAXes and other minicomputers, which geologists used to do complicated models to predict where oil might be found. In terms of utilization, the computer room was arguably the most efficient space in the company: those computers may have been expensive, but they were burning 24/7 to find more oil to extract.


Best of 2024: Check Your Email

by in Best of… on
As we recap some of the best moments of the year, make sure you check this report, which is very important, so important the entire company has to stop what it's doing. Original. --Remy

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?"


Killing Time

by in Error'd on

The Hatter was framed! He didn't even do it! Nil Corpus Delecti, et cetera.

Yet Yitz O. , up to some kind of skullduggery, observed a spacetime oddity. "When trying to compare some results from a GetOrders call via the ebay api, I noticed something weird was happening with the DateTimes in the response. The attached is 3 calls to get the same order, made in quick succession. The millisecond part of all the DateTimes matched the millisecond part of the *current* time (which you can see in the TimeStamp field. I assume it's because they rolled their own DateTime functionality and are Getting a UTC time by subtracting the difference between the local time and the UTC time, and one of those values doesn't have the millisecond value in it, but it's the ebay api so who knows." Undoubtedly a bug that nobody ever noticed because they probably just ignore the millis altogether.


Best of 2024: A Bit About the HP3000

by in Best of… on
As we enter that little gap between Christmas and New Year's, we explore some of the highlights of 2024. We start with this historical computing story. And unlike the subject, this shipped ready to read (and reprint). --Remy

Today's anonymously submitted story is a case where the WTF isn't the code itself, per se. This arguably could be a CodeSOD, and we'll get to the code, but there's so much more to the story.

Our submitter, let's call them Janice, used to work for a financial institution with a slew of legacy systems. One such system was an HP3000 minicomputer. "Mini", of course, meant "refrigerator sized".


Christmas in the Server Room 2: A New Batch

by in Feature Articles on

Last year, we spent our Christmas looking at some Christmas movies and specials, and rated them based on the accuracy of their portrayal of the IT industry. We're going to continue with that this year. Just like last year, we'll rate things based on a number of floppy disks- 💾💾💾💾💾 means it's as accurate as Office Space, whereas 💾 puts it someplace down around Superman III.

Gremlins

Technology has conquered the world, but none of it actually works. As Mr. Futterman (played by the classic character actor Dick Miller) points out: they've all got gremlins in them. Except, thanks to a goofy dad's last minute Christmas gift and some careless 80s teens, the gremlins aren't just taking over technology, but the entire town with their goofy violence.


Tracking Time

by in Feature Articles on

Mihail was excited when, many years ago, he was invited to work for a local company. At the time, he was in college, so getting real-world experience (and a real-world paycheck) sounded great. It was a small company, with only a handful of developers.

The excitement didn't last long, as Mihail quickly learned what the project was: parsing commit messages in source control and generating a report of how many hours a developer worked on any given task. It was a timesheet tracking application, but built on commit messages.


Empty Reasoning

by in CodeSOD on

Rachel worked on a system which collected data about children, provided by parents and medical professionals. There was one bug that drew a lot of fire: no one could report the age of a child as less than one. That was a problem, as for most of their users, child ages are zero-indexed. One of the devs picked up the bug, made a change, and went on to the next bug.

This was the fix:


Hypersensitive

by in Error'd on

Rational Tim R. observed "When setting up my security camera using the ieGeek app there seem to be two conflicting definitions of sensitivity. I hope the second one is wrong, but if it's right, I really hope the first one is wrong."

1


Zero Competence

by in CodeSOD on

Michael had a co-worker who was new to the team. As such, there was definitely an expected ramp-up time. But this new developer got that ramp up time, and still wasn't performing. Worse, they ended up dragging down the entire team, as they'd go off, write a bunch of code, end up in a situation that they couldn't understand why nothing was working, and then beg for help.

For example, this dev was tasked with adding timestamps to a set of logging messages. The logs had started as simple "print" debugging messages, but had grown in complexity and it was time to treat them like real logging.


The Saddest Words: What If

by in Coded Smorgasbord on

Conditional statements, we would hope, are one of the most basic and well understood constructs in any programming language. Hope, of course, is for fools and suckers, so let's take a look at a few short snippets.

Our first installment comes from Jonas.


One Month

by in CodeSOD on

Joseph sends us a tried and true classic: bad date handling code, in JavaScript. We've all seen so much bad date handling code that it takes something special to make me do the "confused dog" head tilt.

		var months=new Array(13);
		months[1]='January';
		months[2]='February';
		months[3]='March';
		months[4]='April';
		months[5]='May';
		months[6]='June';
		months[7]='July';
		months[8]='August';
		months[9]='September';
		months[10]='October';
		months[11]='November';
		months[12]='December';
		var time=new Date();
		var lmonth=months[time.getMonth() + 1];
		var date=time.getDate();
		var year=time.getFullYear();
		document.write(lmonth + ' ');
		document.write(date + ', ' + year);

A Little Extra Padding

by in CodeSOD on

Today's anonymous submitter supplies us with a classic antipattern: padding via switch:

string TransactionOrder = (string)dr["TransactionOrder"].ToString().Trim();

switch (TransactionOrder.Length)
{
        case 1:
                TransactionOrder = "000" + TransactionOrder;
                break;
        case 2:
                TransactionOrder = "00" + TransactionOrder;
                break;
        case 3:
                TransactionOrder = "0" + TransactionOrder;
                break;
        default:
                TransactionOrder = TransactionOrder;
                break;
}

Infallabella

by in Error'd on

The weather isn't the only thing that's balmy around this parts.

For instance Bruce, who likes it hot. "Westford, MA is usually bracing for winter in December, but this year we got another day of warm temperatures. The feels like temperature was especially nice."


Ready Xor Not

by in CodeSOD on

Phil's company hired a contractor. It was the typical overseas arrangement: bundle up a pile of work, send it off to another timezone, receive back terrible code, push back during code review, then the whole thing blows up when the contracting company pushes back about how while the code review is in the contract if you're going to be such sticklers about it, they'll never deliver, and then management steps in and says, "Just keep the code review to style comments," and then it ends up not mattering anyway because the contractor assigned to the contract leaves for another contracting company, and management opts to use the remaining billable hours for a new feature instead of finishing the inflight work, so you inherit a half-finished pile of trash and somehow have to make it work.

Like I said, pretty standard stuff.


A Set of Mistakes

by in CodeSOD on

One of the long-tenured developers, Douglas at Patrick's company left, which meant Patrick was called upon to pick up that share of the work. The code left behind by Douglas the departing developer was, well… code.

For example, this block of Java:


While This Works

by in CodeSOD on

Rob's co-worker needed to write a loop that iterated across every element in an array. This very common problem, and you'd imagine that a developer would use one of the many common solutions to this problem. The language, in this case, is JavaScript, which has many possible options for iterating across an array.

Perhaps that buffet of possible options was too daunting. Perhaps the developer thought to themselves, "a for each loop is easy mode, I'm a 10x programmer, and I want a 10x solution!" Or perhaps they just didn't know what the hell they were doing.


Enterprise Code Coverage

by in CodeSOD on

Alice has the dubious pleasure of working with SalesForce. Management wants to make sure that any code is well tested, so they've set a requirement that all deployed code needs 75% code coverage. Unfortunately, properly configuring a code coverage tool is too hard, so someone came up with a delightful solution: just count how many lines are in your tests and how many lines are in your code, and make sure that your tests make up 75% of the total codebase.

Given those metrics, someone added this test:


Doubled Daniel

by in Error'd on

This week, a double dose of Daniel D.

First he shared a lesson he titled "Offer you can't refuse a.k.a. Falsehood programmers believe about prices" explaining "Some programmers believe that new prices per month (when paid annually) are always better then the old ones (when paid monthly). Only this time they have forgotten their long-time clients on legacy packages."


Building Blocks

by in CodeSOD on

Eli sends us something that's not quite a code sample, despite coming from code. It's not a representative line, because it's many lines. But it certainly is representative.

Here's the end of one of their code files:


On VVVacation

by in CodeSOD on

As often happens, Luka started some work but didn't get it across the finish line before a scheduled vacation. No problem: just hand it off to another experienced developer.

Luka went off for a nice holiday, the other developer hammered away at code, and when Luka came back, there was this lovely method already merged to production, sitting and waiting:


Layered Like Spaghetti

by in CodeSOD on

"We use a three tier architecture," said the tech lead on Cristian's new team. "It helps us keep concerns separated."

This statement, as it turned out, was half true. They did divide the application into three tiers- a "database layer", a "business layer", and a "presentation layer". The "database layer" was a bunch of Java classes. The "business layer" was a collection of Servlets. And the "presentation layer" was a pile of JSP files.


A Pair of Loops

by in CodeSOD on

Alexandra inherited a codebase that, if we're being kind, could be called "verbose". Individual functions routinely cross into multiple thousands of lines, with the longest single function hitting 4,000 lines of code.

Very little of this is because the problems being solved are complicated, and much more of it is because people don't understand how anything works.