DevDisasters

Hired Help for the Holidays

To accommodate an influx of year-end work, Guillaume's employer does what many stores do -- hire on temporary help. However, when you're desperate, beggars can't always be choosers.

It was an annual event on which you could almost always count.

As November drew to a close, the local companies that Guillaume's employer -- a small, five-man IT consulting firm -- serviced would find themselves suddenly up to their eyeballs in new work. Their clients always had money left in their budgets and, under pressure of possibly getting budgets renewed for next year at a lesser amount, switched into use-it-or-lose-it overdrive, making tons of requests for new features and changes that could wait until next year, but heck, we have the money now, so why not?

Not being a group that would turn away piles of cash, they were happy to accept the influx of work, but at the same time, they were nowhere near being staffed for such a large up-tick. Their solution was similar in many ways to that of the big-box retailers: hire on a few extra temporary workers to help.

Now, these guys weren't terrible. They were mostly a motley crew of students and recent grads, literate in C#, and more interested in having beer money than a resume-building experience. And they were good enough to write code that worked, though not always perfectly. So, when Guillaume received a message from one of the firm's clients stating, "We are seeing tons of weird problems in Stage. Exception-somethings everywhere! Do NOT install in Production!" he did what he did every year.

He rolled up his sleeves and assisted in fixing a few bugs.

Guillaume started out by reproducing the issue. As it turned out, the client wasn't kidding. Everywhere Guillaume looked, the application was throwing time-outs and other exceptions all over the place.

Figuring that any spot was as good as any, he jumped in and looked at one of the database calls:

DataSet dsTaskDetails = workhoursbll.ReturnTotalWorkedHours(idFT);
if (dsTaskDetails.Tables.Count > 0 & dsTaskDetails.Tables[0].Rows.Count > 0)

Guillaume thought to himself, "That's good, they check that the dataset does indeed have tables before reading the first one." But then he noticed that, no matter if there was a table or not, the second statement would always run.

Initially, he was puzzled. After all, the code looked reasonable. But soon, it hit him in the face. That's a &, not a &&. Throughout the code, any time a change was made, they were using the binary "and," not the Boolean "and."

Guillaume tried to explain to the team that it's not the same thing; that, yes, in most cases the result of the expression would be the same, but in this case they wanted the if statement to stop evaluating if the first part wasn't met. No matter how hard he tried, though, they kept perpetuating the same errors, as if they just couldn't understand the difference between & and &&.

Defeated, Guillaume just told them to forget about it and to always use &&. Before deploying to stage, he would run a replace-all to fix the changed code, all the while thinking that January couldn't come soon enough.

About the Author

Mark Bowytz is a contributor to the popular Web site The Daily WTF. He has more than a decade of IT experience and is currently a systems analyst for PPG Industries.

comments powered by Disqus

Featured

  • Black White Wave IMage

    Neural Regression Using PyTorch: Training

    The goal of a regression problem is to predict a single numeric value, for example, predicting the annual revenue of a new restaurant based on variables such as menu prices, number of tables, location and so on.

  • Microsoft Ships Visual Studio 2019 v16.9 Servicing Baseline Release

    Microsoft is urging enterprises and professional coders to standardize on the new Visual Studio 2019 v16.9, a servicing baseline release that's guaranteed to receive official support for an extended period.

  • Microsoft Extends Low-Code Push with Power Fx Programming Language

    "Using formulas that are already familiar to hundreds of millions of users, Power Fx allows a broad range of people to bring skills they already know to low code solutions."

  • Microsoft's Tools to Fight Solorigate Attack Are Now Open Source

    Microsoft open sourced homegrown tools it used to check its systems for code related to the recent massive breach of supply chains that the company has named Solorigate.

Upcoming Events