Programming Puns

Writing code, comments, variable names, etc., in the manner that they create a pun.

This is a common and fun practice, but it can be an AntiPattern. Making a pun can detract from the readability of the code. (See MeaningfulNames.) Plus, if you work with the code long enough, some jokes can tire to the point of becoming completely annoying.

Alternately, simply a class of puns which require programming knowledge to be understood.

Examples (of the first kind)

 byte me;
 long john_silver;
 char broiled;
 string me_along;
 float valve;
 double jeopardy;
 struct by_lightning { ... };
 Object strongly;
 class warfare { ... };
 String cheese;
 Exception taken;
 Graphics ex; // XXX
 long walk(short pier) { } // from the MrBunny Java book
 int elligence;
 bool me_over;
 short circus;
 int eger; // ...completing what the designers of the language left out
 char acter;
 bool ean;
 void* bowels;
 class Brick implements Throwable { }
 class Marathon implements Runnable { }
 class Novel implements Serializable { }
 class Human implements Cloneable { }
 Fun(key) %% funky!
 /* Following was seen in the required (at least until 3.8 or so) constructor for a JUnit TestCase.
  * Many words or parts of words can be substituted for man as the variable name for hours of amusement.
  * The shortest that makes sense is just "b".
 public MyTestCase(String man) {
 throw (fit | up | something);
 while (e_coyote) {

When a friend of mine and I were writing an oberon compiler for a class, we would give our objects humorous names, calling the symbol table class "Wingdings", our scope object "Tele", and our Token class "JRR" -- JacobCohen

I frequently add the following commands to my makefile (I am not the originator, I saw this in a makefile myself):

 love: /dev/null
       @echo not war?

It is surprising how many people have just happened to type "make love" and be amused at the response!

yes I'd certainly be suprised that anyone is amused by that.

Examples (of the second kind)

Why do computer scientists confuse Halloween with Christmas? (Don't put the answer here, please... To find the answer, search Google for "computer scientists Halloween Christmas.") -- DanielKnapp

Two strings walk into a bar. One says "I'd like a beer please. 25s3z %- 9238435". The other string says "Sorry about my friend, he's not null-terminated."

Math faculty joke heard around U.Waterloo
First person: Pick a number between 1 and 10. Second person: You mean like, an integer?

How many people can read hex if only you, me and dead people can read hex?

Was that a bitwise or logical and? No. It was addition. I'm sorry, could you speak up, please?

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." Dont focus on the finger, or you'll miss all the heavenly glory

After explaining the XOR swap trick (a^=b,b^=a,a^=b), my friend exclaimed "There is no data, only XOR!" (GhostBusters? reference)

Here's one I dreamed up:

Q: Why did the functions stop calling each other? A: Because they had constant arguments.

That was so bad that it overflew my stack.

HaHaOnlySerious: this has happened to me when I forgot to refactor a method in all the classes in an inheritance chain to have the same const-ness.
There are 10 kinds of people in the world: those who understand binary, and those who don't.

There are only 10 kinds of people in the world: those who understand binary, those who don't, and 8 other kinds.
How does a computer scientist order three beers? He holds up two fingers. -- SriramGopalan

While travelling, I discovered that some cultures count starting with the thumb=1, one finger (and thumb) = 2, two fingers (and thumb) = 3.
A while back, I was explaining something about the use of Boolean variables to a friend, and he came up with "I tried to pass a Boolean once - it was really painful. Then I took a conditional, and I felt much better."

I must apologize ahead of time ...

Q: How does Kent Beck like his Pop-Tarts?

A: Toast-first.

hmm, I thought he likes to have 2 people push the tart into one toaster and pops it out every few seconds to nibble and test if it's perfect and make position/heat changes. When done, only writing '7/10/06 one pop tart' as documentation.

The problem with C++ is that all of your friends can see your private parts.

That's not a problem, it's a feature!

Study shows learning exotic programming languages like haskell, LISP/Scheme accelerates neckbeards & facial hair growth:

I wanted to buy a book on recursion but I didn't find anything relevant in the Self Help section... I got a label maker. The first thing I did was print 'Label Maker' label to attach to it --BrianG
See WorstPunEver, FunnyThingsSeenInSourceCodeAndDocumentation

View edit of April 10, 2014 or FindPage with title or text search