Defensive Programming
by in CodeSOD on 2015-06-17Marino was handed this code. Like all great code, it’s written defensively, protecting itself against nulls, empty strings, and other unexpected values.
I mean, sort of.
Marino was handed this code. Like all great code, it’s written defensively, protecting itself against nulls, empty strings, and other unexpected values.
I mean, sort of.
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.
Our final story is another one of my own, and this one is about… the worst boss ever. I mean it, and in this story, I can prove it. This is also arguably my first interaction with a real WTF.
Whenever a program needs to perform a long running process, it’s important that it supplies some sort of progress indicator, so the user knows that it’s running. Sometimes it’s a throbber, a progress bar, an hourglass, or the infamous spinning beachball of death.
Carol inherited this PHP code, which wants to use a series of dots (“….”)
Managing namespaces in JavaScript presents its own challenge, since the language’s default behavior is to start slapping things into window
. For this reason, people have built a number of libraries and practices to solve this problem.
Jared’s company, for example, uses RequireJS
to load dependencies, like the lodash
utility-belt library. Sadly for Jared, their new hire proved that all the module-loading libraries in the world don’t solve incompetence.
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.
Sarah is a long-time reader of The Daily WTF, and manages to be "all over" the local tech scene. I've met her at a few TDWTF meetups, but also seen her at Code & Supply events. And today's story features robots, so what's not to love.
A few months back, Alex announced our sponsorship program. This has been a great partnership that’s helped us bring you our regular content, but also special features like TDWTF: Live.
We’re proud to introduce our second sponsor: Infragistics
Rebecca inherited some code that’s responsible for gathering statistical data from network interface. It was originally written a decade ago by one of those developers who wanted to make certain their influence was felt long after they left the company.
The code was supposed to write to one of two log files: a “quick log”, with 2-second resolution (but only for the last minute’s data), and a “full log”, with 1-minute resolution.