Dan J.

Dan J. lives in Vancouver, BC. He's been developing software for going on eight years, during which time The Daily WTF has gotten him through many a terrifying codebase.

Oct 2013

Remember, Remember the Thirty-Third of November

by in CodeSOD on

Some say that time is nothing but an illusion. The degree to which some software developers struggle with times and dates certainly suggests mysterious and unknowable forces swirling beyond the brink of human understanding. Consider this code that Ian found while pruning an old application. It's meant to provide the correct suffix for any given day of the month:

string num = "th";

int day = Convert.ToInt16(DateTime.Now.ToString("dd"));
switch(day)
{
    case 1:
        num = "st";
        break;
    case 21:
        num = "st";
        break;
    case 31:
        num = "st";
        break;
    case 2:
        num = "nd";
        break;
    case 22:
        num = "nd";
        break;
    case 3:
        num = "rd";
        break;
    case 33:
        num = "rd";
        break;
    default:
        num = "th";
        break;
}

What Should He Do, Indeed

by in Tales from the Interview on

Leighton started his career as an apprentice ICT technician for a Secondary school. The job was roughly what you would expect, but the interview went down as one of the most surreal moments of Leighton's life. With his first interview scheduled to begin at 9:15 AM, Leighton arrived forty-five minutes early in his new suit and tie. At T-minus two minutes he remained the only candidate in the reception area, and his confidence was growing. But at 9:13, in walked Dave.

Dave had a strut to him, an air of cool detachment that Leighton couldn't seem to match, even though they were about the same age and Dave had elected to wear jeans and a t-shirt. It turned out they were vying for the same position, but while Leighton was relying on his community college experience, Dave had been putting computers together since he was in Secondary school. By the time the receptionist asked them who wanted to go first, Leighton's confidence was on the floor in pieces. His brand new tie seemed uncomfortably tight, and the collar of his dress shirt kept tickling his neck. Dave was out of his chair before Leighton could say anything, and looked back at his competitor with a smirk.


Advanced Adventures in ActionScript

by in Feature Articles on

"That's a natural twenty," Eric said, leering at his coworkers over his Dungeon Master's screen. "Tim, the kobold decapitates your Elven Ranger." The players groaned, and Tim could only mutter in protest. This was only their first adventure, and his character was already dead? Eric smiled. Tim and Alanna would soon learn that suffering abrupt decaptitation in their weekly Dungeons and Dragons game was much-needed preparation for their new jobs at ScriptCloud.

Eric had only joined the company a few months prior, as their first in-house developer. "They" were ScriptCloud Actionware, a local startup dedicated to reinventing the world of mobile app development. With the hindsight that only half a year of nonsense can bring, glimpses of ScriptCloud's deep-seated WTFitude were there right from the beginning. The interview process had gone slowly, not because of stiff competition or a monolithic HR department, but because ScriptCloud had chosen to post the job opening right before their entire staff went on summer vacation. The staff meeting on Eric's eventual first day was somewhat unnerving, ending as it did with the CEO swearing at the creative director after a twenty-minute argument about a single screen of the app's user interface. The app in question was ScriptCloud's first, a game with about the same complexity as Angry Birds (if none of the success). It was built by Costly European Consultants, and it would be Eric's job to support it.

White Plume Mountain


An IDE Impostor

by in Feature Articles on

Despite having written code for twenty years before he'd even turned thirty, Jim couldn't help feeling like a bit of an impostor. He wasn't suffering from the Capgras delusion, though. He felt the way many of us feel when presented with a new job using new technology - in this case, the .NET framework and C# - that surely he couldn't be good enough at this to keep the job for very long. Surely his peers would find him wanting. While Jim struggled with his own self-worth, one thing he didn't struggle with was choice of IDE: Visual Studio. Intellisense, one-click refactoring, and a host of other features allowed him to fake it till he could make it. As far as Jim could tell, there was no reason to use anything else when developing a .NET solution.

Jim's first assignment was to work on a codebase created by Biff. Biff was a Something-Something-Level 3, so Jim was ready to learn a few new things when he fired up Visual Studio and opened Biff's solution. And learn he did. For example, he learned that VS marks syntax errors with a red, squiggly underline, much like Microsoft Word does with spelling and grammar mistakes. Biff's code lit up like a first-grader's essay about summer vacation, loaded as it was with misspelled identifiers, missing semicolons, and AWOL closing braces. Jim would have wondered if Biff had ever tried to compile the mess, but he was too busy wondering if the senior developer made a habit of typing with his eyes closed, since Visual Studio would have helpfully pointed out these sorts of mistakes as he made them.