The Daily WTF - RSS Feed

Curious Perversions in Information Technology

Latest articles

CodeSOD: New Anti-Pattern Just Dropped

Linda discovered a new anti-pattern, helpfully explained with comments. try { this.initializeConfig(this.configFile); } catch (ADWException e) { // something went terrible wrong... but we go on, since // following errors will be thrown. } I'll call this the delayed catch pattern. We know something went wrong, and in this example, we...

CodeSOD: Weakly Courses

Kerin inherited a scheduling application for a university. This application stored the scheduled days for a class in the database… as one comma-separated field. This was a problem for Kerin, who was hired to add predictive scheduling and classroom density measurements to the system. This particular function was written to take that data and transform...

CodeSOD: Nullable or Not

Nullable types, at least in theory, make our code simpler and easier to maintain. If nothing else, we know when there's a risk of a null value, and can handle it with some grace. At least, that's how it works if we understand what they do. Boaz's co-worker knows that nullables are valuable, but doesn't quite get it. public ulong? ParentOpinionId {...

Error'd: Nice Work If You Can Get IT

Danish cookie connoisseur Jørgen N. contributes our starter course this week. "Cloudera has an interesting way of implementing "Required only" cookies." It's an exercise for the frist poster to explain to the peanut gallery what's so distasteful about third-party cookies.   Studious Olivier sagely notes "Anatomy has been a subject...

CodeSOD: The String Buildulator

"Don't concatenate long strings," is generally solid advice in most languages. Due to internal representations, strings are frequently immutable and of a fixed length, so a block like this: string s = getSomeString(); s = s + "some suffix"; creates three strings- the original, the suffix, and the third, concatenated string. Keep spamming...

CodeSOD: Failed Successfully

Martin's company had written a set of command line tools which their internal analysts could then string together via shell scripts to do their work. It was finicky and fragile, but frankly didn't work too badly for most cases. There was one tool, however, which seemed to be the source of an unfair number of problems. Eventually, Martin sat down with...

CodeSOD: The GUID Utillity

Let's say you saw a method called StrToGuid, in a C# codebase. Your first thought might be: "Wait, isn't there a built in parse? Well, I guess maybe they might do some sort of exception handling. But it still doesn't seem right." And then you'd take a look at the method signature and see that it takes both a string, and an integer named counter, and...

CodeSOD: An Animated Block

"There are a few more functions like this in the same file," writes Jenny, about today's submission. This is one which largely does speak for itself. const gright = () => { setIscountright(isCountright + 1); if(isCountright === 0) { setIsleft(!isLeft); setIsfirstdot(!isFirstdot); setIssecdot(!isSecdot); setInfof('Once activated...

Error'd: Irony

This week's edition of Err'd gets off to a flying start with one that came in "over the transom" as t'were. Ordinarily, expired certs are a bit mundane for this column, but in this case, where this foible fetched up is at least worth a chuckle. Jim M. wrote directly to the editor with this explanation. "If you're looking for compliance reports...

CodeSOD: Nullable Booleans

Austin's team received a bug report. When their C# application tried to load certain settings, it would crash. Now, since this was a pretty severe issue in their production software, impacting a fair number of customers, everyone on the team dove in. It didn't take Austin long to spot the underlying problem, which isn't quite the WTF. bool? setting;...

Discover, share and read the best on the web

Follow RSS Feeds, Blogs, Podcasts, Twitter searches, Facebook pages, even Email Newsletters! Get unfiltered news feeds or filter them to your liking.

Get Inoreader
Inoreader - Follow RSS Feeds, Blogs, Podcasts, Twitter searches, Facebook pages, even Email Newsletters!