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

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube