DEV Community

Ahmed Musallam
Ahmed Musallam

Posted on

Do you leave jokes in your code? If so, please share!

Sometimes, I leave bad jokes in my code, here are some examples from a backup tool I built a while back:

When a user tries to delete a backup:

console.log(`Still wanna do it? just checkin'...`)

When trying to remove a backup but something wrong happens:

spinner.fail(`ummm, yeah.. this is awkward; we could't delete the backups for some reason`)

When the user tries to remove a backup, but then cancels at the prompt:

console.log(`Whew, nothing happened. That must feel good, eh?`.green)

When something goes wrong:

spinner.fail('womp womp... some error occurred *rolls eyes*')

Other times, I add a funny* comment to a funky looking piece of code, just because..

I am curious if other devs do it to, do you do anything like that? funny comments? funny method/variable names? or funny messages you show to users? please share!

*Depends on whom you ask ;)

Oldest comments (54)

Collapse
 
fpuffer profile image
Frank Puffer

No. I never do that. Not that I have an issue with jokes. But you can bet that at least some users or other stakeholders won't understand the joke and instead view it as a lack of professionality.

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

Well of course! Context matters! I’m not talking about delivering jokes in products used by thousands of users (unless that’s part of your marketing strategy). Context matters, and I am usually careful about where the joke is placed and who’s going to read it.

In my specific case, this tool is open source, and is used exclusively by developers.

Additionally, I might leave a joke in a comment even in client code. I don’t think that’s going to be the reason a client thinks I’m unprofessional.

It goes without saying, inappropriate jokes have no place in this discussion. That’s just part of being respectful to other humans.

Collapse
 
vicoerv profile image
Vico

i thought you bring jokes to comment, but in user interaction?

Collapse
 
ben profile image
Ben Halpern

I tend to shorten button to butt, which seems clear enough, isn't overly offensive, but makes me chuckle just because I'm writing butt.

And even still I kind of regret not just writing button for clarity. 🙃

Collapse
 
vlaem profile image
Alvaro

I use btn instead.
but I may start using butt from now on

Collapse
 
fgiraldi profile image
fgiraldi

Be careful on how you use your butt

Collapse
 
hudsonburgess7 profile image
Hudson Burgess

I got fed up with badly written assignments in my last semester of college and left some comments criticizing the requirements 😛

Collapse
 
teej profile image
TJ Fogarty

Oftentimes, my code is the joke 🤷‍♂️

Collapse
 
nerkmind profile image
Lewis Clarke

relatable

Collapse
 
hdennen profile image
Harry Dennen

Given a long enough time frame, this becomes true for most code.

Collapse
 
moopet profile image
Ben Sinclair

I don't do this. It can come back to bite you in too many ways, such as

  • clients reviewing code and thinking you're unprofessional
  • clients thinking you're being rude about them (even if you're not)
  • bugs being harder to track down because your replacement is left searching a mountain of code for things like "whoops!"

I'm not saying I haven't done that sort of thing before; I just try not to do it now.

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

I see your point, and I get it. It really depends on your client and your work culture. Nothing wrong with being on the safe side.

Collapse
 
itachiuchiha profile image
Itachi Uchiha • Edited

Our software which we use in the office, I leave a code like this:

const err = {
    count: 0
}

const btn = document.querySelector(".js-btn-remove")

btn.addEventListener("click", () => {
    if(err.count == 5) {
                // omg, you can't be serious. you're still trying...
        myFancyMessage({
                   title: 'Leave me alone...',
                   text: [
                      'unhappy',
                      `Don't do this again. You almost kill me. This hurts me.`,
                   ]
                })
        return false;
    }

         myFancyMessage('Warning', 'You are not authorized to remove sales.')        

    // some important codes
    err.count++

})
Enter fullscreen mode Exit fullscreen mode
Collapse
 
keinchy profile image
Frederick Jaime

err.count == 5? how did you come up with this number?

Collapse
 
itachiuchiha profile image
Itachi Uchiha

5 is my favorite number. :P

No, it just an example. I just exemplified the scenario.

Collapse
 
mercier_remi profile image
Rémi Mercier

This is precious! 😄

Collapse
 
bsalesc profile image
Bruno Sales • Edited

I never did in products that I've worked, but where I work currently there are internal systems that when it's blocked for maintenance shows the Travolta confused :D And it makes me LOL...

Travolta confused

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

That’s awesome!

Collapse
 
patricktingen profile image
Patrick Tingen

At one client, they were using a home-grown issue tracking system called Bob, after Bob the Builder. It even had an image of Bob the Builder in the application itself.

As a little joke, I built in a timer that at random times replaced the image of Bob with one where one eye was closed, wich made it look like he was blinking every now and then. It took a week and a half before someone noticed. I had a hard time not to laugh and to keep my face straight, while asking: "what do you mean, Bob is blinking? Are you serious?"

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

This is gooood! 😂

Collapse
 
janpauldahlke profile image
jan paul • Edited
//this should work, but...
//the night is dark and full of errors 
  onCheckBoxChange = (val: string ) => (_e: any) => {

    if (typeof this.props.updatePermission === 'function' && this.props.officerId && this.props.officerId >= 0) {

      this.props.updatePermission(this.props.officerId, {
        ...{ isValidAsPast : this.props.isValidAsPast, isValidAsUpcoming: this.props.isValidAsUpcoming},
        [val] : !this.props[val] } as PermissionPartial 
        ); 
    }
  }
Collapse
 
ahmedmusallam profile image
Ahmed Musallam

Hahahaha, this great! Might steal that from you ;)

Collapse
 
codemouse92 profile image
Jason C. McDonald

"The night is dark and full of errors."

How is this not a meme?

Collapse
 
andhop profile image
Andy Hopwood

I sometimes swear on mine

If(mybool === false){
   // Do f**k all
}
Collapse
 
dallgoot profile image
dallgoot

Manyt times...
usually it gets removed at the end with the crappy code that caused the frustration :)

Collapse
 
cjbrooks12 profile image
Casey Brooks

All of my mock data tends to be characters from Harry Potter, Doctor Who, or Disney. I've even written an entire library where everything is a reference to Harry Potter.

Also, my wife is a teacher and I built her a website to manager her gradebook, and used Huey, Dewey, and Louie for the test students. Her class got a kick out of it when they saw those names as she was showing them how to log on. 😂

Collapse
 
cjbrooks12 profile image
Casey Brooks • Edited

I also love the little gems hidden in the Android codebase

Collapse
 
qm3ster profile image
Mihail Malo

What do the latter two actually do?

Collapse
 
cjbrooks12 profile image
Casey Brooks

isUserAMonkey() is actually part of a testing utility. A "monkey" user does a bunch of random clicks and stuff trying to detect strange UI states.

The last one was just a joke, but it does check if GoatSimulator is installed

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

I recently used this code comment.

//////////////
// Nonsense //
//////////////
//
//   <reason why I had to do nonsense>

To clarify, I leave this in the code. The code had to be written to dull a weird edge of a library. It was odd in comparison to the rest, so I needed to explain. It is hoped that one day the weird edge will go away and I can remove the code.

Collapse
 
sebastienkb profile image
Sébastien Kalb

I once copied code of my colleague Mark, including the Created by Mark comment. To fix this, I git-pushed:


I tried to frame Mark for a crime he didn't... commit.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.