Remy Porter

Remy is a veteran developer who writes software for space probes.

He's often on stage, doing improv comedy, but insists that he isn't doing comedy- it's deadly serious. You're laughing at him, not with him. That, by the way, is usually true- you're laughing at him, not with him.

Every Day

by in CodeSOD on

There are real advantages to taking a functional programming approach to expressing problems. Well, some problems, anyway.

Kevin sends us this example of elegant, beautiful functional code in C#:


The Right Helper

by in CodeSOD on

Greg was fighting with an academic CMS, and discovered that a file called write_helper.js was included on every page. It contained this single function:

function document_write(s)
{
   document.write(s);
}

The Mask Service

by in CodeSOD on

Gretchen saw this line in the front-end code for their website and freaked out:

let bucket = new AWS.S3({ params: { Bucket: 'initech-logos' } });

Walking the DOGE

by in News Roundup on

One thing I've learned by going through our reader submissions over the years is that WTFs never start with just one mistake. They're a compounding sequence of systemic failures. When we have a "bad boss" story, where an incompetent bully puts an equally incompetent sycophant in charge of a project, it's never just about the bad boss- it's about the system that put the bad boss in that position. For every "Brillant" programmer, there's a whole slew of checkpoints which should have stopped them before they went too far.

With all that in mind, today we're doing a news roundup about the worst boss of them all, the avatar of Dunning-Kruger, Elon Musk. Because over the past month, a lot has happened, and there are enough software and IT related WTFs that I need to talk about them.


Double Checking

by in CodeSOD on

Abdoullah sends us this little blob of C#, which maybe isn't a full-on WTF, but certainly made me chuckle.

if (file!= null)
{
  if (file.name.StartsWith(userName))
  {
    if (file.name.StartsWith(userName))
    {
      url = string.Format(FILE_LINK, file.itemId, file.name);
      break;
    }
  }
}

Finally, a Null

by in CodeSOD on

Eric writes:

Yes, we actually do have code reviews and testing practices. A version of this code was tested successfully prior to this version being merged in, somehow.


Simplest Implementation

by in Representative Line on

As the saying goes, there are only two hard problems in computer science: naming things, cache invalidations, and off by one errors. Chris's predecessor decided to tackle the second one, mostly by accurately(?) naming a class:

class SimpleCache
{
}

On Deep Background

by in CodeSOD on

Andrew worked with Stuart. Stuart was one of those developers who didn't talk to anyone except to complain about how stupid management was, or how stupid the other developers were. Stuart was also the kind of person who would suddenly go on a tear, write three thousand lines of code in an evening, and then submit an pull request. He wouldn't respond to PR comments, however, and just wait until management needed the feature merged badly enough that someone said, "just approve it so we can move on."

int iDisplayFlags = objectProps.DisplayInfo.BackgroundPrintFlags;

bool bForceBackgroundOn = false;
bool bForceBackgroundOff = false;

// Can't use _displayTypeID because it will always be 21 since text displays as image
if (_fileTypeID == 11) // TEXT
{
    if ((iDisplayFlags & 0x1008) != 0) // Text Background is required
    {
        bForceBackgroundOn = true;
    }
    else if ((iDisplayFlags & 0x1001) != 0) // Text Background is not available
    {
        bForceBackgroundOff = true;
    }
}
else if (_displayTypeID == 21) // IMAGE
{
    if ((iDisplayFlags & 0x1200) != 0) // Image Background is required
    {
        bForceBackgroundOn = true;
    }
    else if ((iDisplayFlags & 0x1040) != 0) // Image Background is not available
    {
        bForceBackgroundOff = true;
    }
}

bool useBackground = bForceBackgroundOn;

// If an object does not have an Background and we try to use it, bad things happen.
// So we check to see if we really have an Background, if not we don't want to try and use it
if (!useBackground && objectProps.DisplayInfo.Background)
{
    useBackground = Convert.ToBoolean(BackgroundShown);
}

if (bForceBackgroundOff)
{
    useBackground = false;
}

Archives