What Is The Worst Comment In Your Code?

twitter logo github logo ・1 min read

Inspired by the thread Software developers of Reddit, what is the most shameful "fuck it, it works" piece of code you've ever written?, I wanted to ask what horrible/funny comments you have in your code.

In my main code base, 1000 lines in to a 2.5k line file, sits this beauty:

//================YOU ARE ENTERING HELL ON EARTH=======================
//======================THE PAIN STARTS HERE===========================

I tried to refactor it once or twice, but I think I just got myself more jumbled as a result.

What signposts lie in the dark tunnels of your code to guide any unfortunate souls who had to venture that deep?

twitter logo DISCUSS (18)
markdown guide
 
# bleeeee bleeeeeee bleeeeeeeeeeeeee -> isso foi eu vomitando enquanto fazia esse codigo

which translates more or less to

# bleeeee bleeeeeee bleeeeeeeeeeeeee ->  this was me vomiting while coding this.
 
// Don't ever mind to think about it.
// It is what it is, get over it.

within a legacy codebase I had to maintain a while ago.

 
/* Why is it written like this? 
Now we're committed unless limitless
resources magically appear to afford
the refactor. Don't do this!
*/
 
// hack, don't want to think about this

EDIT: Never mind, found a better one, for when I was refactoring a ps1 script written four years ago by another team:

# NOTE TO FUTURE DEVELOPERS: If you're wondering where things like
# "Set-OnlineCASMailbox" are defined, it comes from the import-pssession
# call on the Exchange/Lync/etc sessions. The names
# of the commands are changed by the -prefix argument.
# I have no idea why this is even a thing you can do in Powershell,
# but I'm not changing it. --Derek
 
 

I really loved this one, although its not from my project, rather from online :p
Exception up = new Exception("Something is really wrong.");
throw up; //ha ha

 
// TODO: This test is finicky; ignore its fails

I had this on a handful of tests that would randomly be like Expected 'long-ass string of content' but got '' though I think I fixed it today, so woo deleting todos!

 

Years ago I remember being humored by the only comment in a very long Perl script; there were hundreds of lines with no comments at all, and about 2/3 of the way down the file there was a command which output some spaces to the screen with a comment on the end of the line "spaces".

print("        ");    // Spaces

I believe my reaction was something like: really out of all the things you write a comment for it is the most obvious thing in the whole file? I showed some of my colleagues at the time and we all had a good laugh about it.

 

It's a classic I never thought I'd get to see in real life, but a couple of weeks back I found this gem.

// limit is 70
const limit = 50
 

Somebody added two comments to code written by another team member:

// Yuck... --<name redacted>
// Double yuck... --<name redacted>
 

My favourite was this:

function sendSendmailMail

With the accompanying comment:

// Look, I don't even have time to name this function properly let alone write it
 
/*
      Bad code warning :(
      [6 line explanation of why I wrote the code]

 */
 
 
// Will come back and fix this later

On a file that hasn't been touched in 3+ years. It's not very artistic or dramatic, but fffff....

 

In my big honkin WordPress plugin I built:

// USING $_GET IS $_KLUDGY_AS_FUQ

 
 
 
// To <Name redacted>: I will hunt you down and shoot you
// if you ever block an async call in this module again.
Classic DEV Post from Nov 20 '18

Dumb algorithms make us dumb

Should we all just quit our job to save the planet from fake news and fascism?

James profile image
web developer, rubyist, friend