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 ;)
Top comments (55)
Oftentimes, my code is the joke 🤷♂️
relatable
Given a long enough time frame, this becomes true for most code.
I tend to shorten
button
tobutt
, 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. 🙃
I use btn instead.
but I may start using butt from now on
Be careful on how you use your butt
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?"
This is gooood! 😂
I also love the little gems hidden in the Android codebase
What do the latter two actually do?
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
Our software which we use in the office, I leave a code like this:
err.count == 5? how did you come up with this number?
5 is my favorite number. :P
No, it just an example. I just exemplified the scenario.
This is precious! 😄
"The night is dark and full of errors."
How is this not a meme?
Hahahaha, this great! Might steal that from you ;)
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...
That’s awesome!
In the test case:
This.
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.
I recently used this code comment.
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.
I got fed up with badly written assignments in my last semester of college and left some comments criticizing the requirements 😛
I quite often use movie, and other pop culture, references. For example, in development and test mode pages include a Pi symbol in the lower left corner which shows some debug information when you click on it.
There have been cases where the final error message was
PC Load Letter
, if no better error message was available.Or when resizing an array the comment
// We're going to need a bigger boat
is very suitable.For an internal CA I used the department name Setec Astronomy.
Our CTO once put a client into maintenance mode accidentally. When that happens, the client can't log into their account or anything. He panicked and started blowing up Slack asking about how to reverse it. Since then we have a confirm dialog on that button that says
That was added over a year ago. What is better is that a newer dev recently saw it and assumed we had incorrectly identified the user. He was quite amused when we told him, nope, that was on purpose. 😂
One of our developers, Scott, was well-known at MousePaw Media for possessing a lethally dry wit. I made the mistake of asking once for a "yay or nay" on something, and from then ever afterwards, he'd respond to yes/no questions with "yay" or "nay". It caught on at the company, even prompting a pair of yay-nay T-shirts to be made for our holiday gift exchange.
When we wrote
IOChannel
, a featureful wrapper around C++'sstd::iostream
, we offered a few formatting flags for printing boolean variables. Among those is the undocumentedbool_scott
......which would output...
Meanwhile, the official (still unpublished) specification for our upcoming language contains these little gems...
Error 22 is actually useful for "can't happen" scenarios. There will be some way get it to print out the second message instead, though.
If a user hadn't used the new feature the UI needed to display a "new" icon next to it's menu link. so...
Some comments may only be visible to logged-in visitors. Sign in to view all comments.