When you are writing code or naming products, which sources of cultural references are you most likely to draw from? Which reference sources do you think are more likely to be universally understood?
For example when findbugs sees that you've implemented equals() without overriding hashCode() it suggest that you implement it by returning 42 (a reference from HHGTTG)
Or why we have big endian vs little endian encoding, referencing Gulliver's Travels
Not that we should act unprofessionally with our code, but if you going to tell a person that they could only (watch/read/...) one (book/movie/show/...) which one would allow them to 'get' the most jokes?
Microsoft Code has lots of good comments (Taken from Windows 2000)
// The specific idiot in this case is Office95, which likes
// to free a random pointer when you start Word95 from a desktop
// shortcut.
or:
private\genx\shell\inc\prsht.w:
// we are such morons. Wiz97 underwent a redesign between IE4 and IE5
private\shell\ext\ftp\ftpdrop.cpp:
// We have to do this only because Exchange is a moron.
private\shell\shdoc401\unicpp\desktop.cpp:
// We are morons. We changed the IDeskTray interface between IE4
private\shell\browseui\itbar.cpp:
// should be fixed in the apps themselves. Morons!
Or:
private\shell\ext\tweakui\genthunk.c:
/* CallProc32W is insane. It's a variadic function that uses
* the pascal calling convention. (It probably makes more sense
* when you're stoned.) */
Finally, this makes you wonder about the build process over at MS:
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!IF YOU CHANGE TABS TO SPACES, YOU WILL BE KILLED!!!!!!!
* !!!!!!!!!!!!!!DOING SO F**KS THE BUILD PROCESS!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
make
? and if you do it on my make files, I might kill you. - dlamblin
Ok, not actually real production code, more compilable doggerel...
public class MohammedAli {
float like_a_butterfly;
string like_a_bee;
}
and the somewhat more elaborate:
public class LunchOrder {
double cheeseburger;
char grilled;
long drink;
short cake;
}
class CEO { short hours; long perks; BigInteger pay;}
- fastcodejava
int eger;
- slacker
Once, a couple of years ago, I was working with some custom XML for an installer. In my late night frustration I just couldn't figure out why this one "feature" wouldn't work. That is, until I got this error message:
The Product element contains an unexpected child element 'Bastard'.
This was totally unintended and has kept me laughing to this day...
Taken from the xkcd comic Random Number [1]
int getRandomNumber()
{
return 4; //chosen by fair dice roll.
//guaranteed to be random.
}
[1] http://xkcd.com/221/I just found this Stored Procedure in our database.
ALTER PROCEDURE ORly
AS
print ' {o,o}'
print ' |)__)'
print ' -"-"-'
print 'O RLY?'
print ' '
print '{o.o}'
print '|)_(|'
print '-"-"-'
print 'YA RLY'
print ' '
print ' {o,o}'
print ' (__(|'
print ' -"-"-'
print 'NO WAI!'
When I was using VB6, I often had my error handling look like:
On Error GoTo Hell
I used it again when writing code in VBA for access. My then very Christian manager nearly had a heart attack when he saw it, and made me change it :(
// every time you call this a kitten dies somewhere
O(n3) method follows...
I was writing a class to crawl the web so naturally the class definition was like this:
public class WebCrawler //: public SpiderMan, private PeterParker
{
};
I usually write very straight-edge code, and try to name things as clearly as possible. But sometimes a good, logical name turns out to be funny.
I was building a "safe search" filter for a popular online video site. You may have used it. It just keeps the sexier videos out of your sight unless you explicitly toggle your settings to include them.
So I needed to name a method for bringing the sexy videos back into the user's video queries.
I couldn't help myself:
UserManager.bringSexyBack();
It's in production. Millions of people bringSexyBack() every day.
I giggle every time I shorten "Assembly" to "ass" in .net:
var myAss = this.GetType().Assembly;
Not really a cultural reference, but I'm fond of using the HTML blink tag in my Javadoc.
I've always waited for the occasion to write the following comment inside a C++ class declaration with private members and friend classes:
// Only friends are allowed to see each other's private members.
SEX (SignEXtend) mnemonics was removed from the Assembly language for Intel microprocessors but ANL and ORL (Logical-And and Logical-Or) were allowed.
Here's another one:
while ("my guitar gently weeps") {
...
}
I once worked on an app that had an interface for auto handling persistence of "dirty" objects. The interface was named...
ICanBeDirty
... and still makes me laugh, the guy who wrote it hadn't even realized that it was funny when I asked him about it.
My favorite, and one I now sometimes borrow was seeing this in a Makefile:
love :
echo "not war"
There are so many funny comments in the OS-world. I like this one:
return(0); // Another brick in the -Wall
(It is one of those returns that never could be reached.)
Monty Python references. But then, I'm a Python programmer.
I once saw an especially clever comment used Morse code as an implicit message....
// .... . .-.. .-.. --- .-- --- .-. .-.. -..
// begin section
// .... . .-.. .-.. --- .-- --- .-. .-.. -..
Love it... +1 with sentiment that shenanigans should be in comments and not variable names.
One wingnut I had the pleasure of working with used to work in the names of his ex-girlfriends to variable names.
Dim Jessica as String
Ugh.
In the days when Pascal was a popular teaching language and a common exercise was to write a program to output graphics using a pen printer (one of those that moves a pen across a page, raising and lowering the pen to draw) we had a lecturer who used to delight in the pointing out the pitfalls of the convention of naming pascal variables by joining words and in fixing capitals, i.e. the common boolean variable name :-
PenIsUp
In C++:
#define true false // happy debugging losers
I've twice had to create a Log class for message logging. Both times I put this comment in the class header:
// What rolls down stairs
// alone and in pairs
// and flattens the neighbor's dog?
// What's great for a snack
// and fits on your back?
// It's log, Log, LOG!
double pi = 3; //M:find correct value
This "inaccuracy" was hidden in the code for about 3 years before I discovered it.
for(int c = 0; c < 10;)
{
c++; // < get it? c++ ? it's so... literal
}
Once I was going through some old application code for maintenance and I came across these comments within an empty function block:
"Alex will be coming tomorrow to write code here." It was commented with a very old date. Obviously, something happened to Alex or else it would not have remained empty.
I was curious and made some enquiries about Alex with some old timers. One of the guys mentioned that it might have been the guy who admitted he could not code from Day 1 and needed some training. He was fired the same day.
Not sure what happened to the guy who put the comments in the first place.
char coal;
short cut;
long way;
float assets;
string tanga;
double penetration;
object slide;
UserPermissionException up = new UserPermissionException();
throw up; // lol
return off;// the Jedi;
int eastwood
and char guevara
– we had those at uni ^^ - poke
double entendre
- not as explicit :) - gnud
In unit tests, I'll do HHGTTG, Office Space, Idiocracy and occasionally (only occasionally) Star Wars references.
In my production code, no. No way. I try to keep that as professional as possible, down to the comments -- at least what gets checked in. Not only does it make my life easier when I'm maintaining it six months down the road, but it makes the lives of anyone else who has to maintain it easier. Humor has a place; in my mind production code isn't it.
(That said, I'm not above a little easter egg in an about box with some humor -- as long as it's zero-impact on the application's functionality.)
I think one of the funnier ones I've seen is a perl function that had a hash named ofTheJedi (instead of some generic "this holds data" name).
Then only reason it was named that way was so the return statement was 'return %ofTheJedi'.
I've seen lots of HHGTTG references, lots of star wars references, and the odd Dr Who/Battlestar reference.
This is from the app we're currently working on. For all fans of dodgy 80's pop:
if($res) {
$karma = $res['Karma']['karma']; // karma karma karma chameleon
}
There is an xkcd forum thread with quite a nice collection of Funniest/Most Annoying Code Comments [1]
[1] http://forums.xkcd.com/viewtopic.php?f=11&t=11935&start=0&st=0&sk=t&sd=aMagic number in Java class files: 0xCAFEBABE
[localhost ~]$ hexdump -C Foo.class | head
00000000 ca fe ba be 00 00 00 31 00 46 0a 00 14 00 1f 09 |Êþº¾...1.F......|
If you're going to put jokes in your code, PLEASE for God's sake do it in the comments. There's nothing more annoying than variables or methods with "hilarious" names. It really does make the code more difficult to understand.
But I'm all for funny comments. (And there's more to humor than referencing obscure TV shows.)
<?php $_GET['rich'] or die('trying'); ?>
I try to avoid doing that. Can make it more difficult for others with different backgrounds to maintain the code.
Looking through some code from earlier this year, I found some silly comments.
In a C file that converted to/from Roman numerals, the "last update" timestamp had the year written in Roman numerals. That was the only file in the project that had it. Later on, in another number crunching file, it included some things regarding the above-mentioned Roman numerals:
#include "roman.h" //He has a wife, you know... Know what's she called?"
There's also a function I first encountered in Nethack and lovingly adopted: strkitten(char*,char);
abstract class Sex {
}
class SexWoMen extends Sex {
long duration;
}
class SexMen extends Sex {
byte duration;
}
acceptable usage of breaks and contunues in java:
dance:
while(some_bool){
//something in loop
...
if(some_condition)
break dance;
}
and:
the_assault:
while(something){
//body
...
if(condition)
continue the_assault;
}
or something to that effect.
One of my favorites was a file with in the header something like
// Author: Mike
and a bit later, in a function, something like
// Mike: whoever wrote this code should be put against the wall and shot
Anyway, be very careful about being too clever. Blowing off steam in comments is fun, but maintainability should always trump funny. Never, ever, try to be clever with variable naming.
It's all fun and games, until a bug makes your attempt at humor visible to the customers...
My favorite is a comment a co-worker added to a safe-delete function we had in c++. It was very hackish, but it protected from some null problems in a code-base that wasn't checking nulls often enough.
class WidgetBase
{
void SafeDelete()
{
if (this)
delete this;
/*
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing, end them.
*/
}
}
To answer your question, I suspect Hitchikers Guide to the Galaxy is the single book from which the most programmer humor comes from, but that may just be personal experience. I have seen very many comments and variable names that came from there.
But other than that, we're all over the board on our references... I remember seeing one comment in a chunk of perl code that had given the developer a lot of trouble:
# Touch this code and die like Biggie and Tupac
.
.
.
# /Touch
from OpenRasta
public interface IHas : INoIzObject {}
A friend of mine uses this status message when he's asleep :)
while(awake) sheep++;
If(true)
//Just to be sure =)
Lol
Scott Meyers in
comp.lang.c++.moderated
[1]:
using namespace std; // so sue me
[1] http://groups.google.com/group/comp.lang.c++.moderatedTo combat out project being offshored to Cambodia we try to include the occasional reference that other cultures might not understand.
i.e.
To find the parent site in MOSS:
WhoIsYourDaddy();
My favourite: 42, second place: Towel. And just to show that I have read other books too (3 or 6, depending on the way you count): Precioussssss...
I used quotes from Office Space as strings in unit tests.
Another one I used to enjoy when I did COM programming was to place the following above a QueryInterface call:
// QueryInterface for the Straighty Interface
or, alternately:
// QI for the Straight Guy
I prefer unintentional humor...
Legacy code is perfect for that.
Dim intOrderID AS Long
Or sometimes when the comments have long ago become out of sync with the code they were referring to.
Reality truly is stranger than fiction....
In a class to manage several threads:
public Collection getRuns()
{
return new ArrayList( runs ); //return chinese food
}
Got some nice comments with no reference at all :)
'2002 07 22 [Jon] Temporary fudge for AMEX
'2005-02-23 [Dominik] Temporary is relative ;)
(It's still in there ;) )
We named an internal application LIGERS. Needless to say, we were thrilled to be able to fit in a reference to Napoleon Dynamite.
In a debugging session with colleagues I said "set the break to 0xC0FFEE", meaning: "Let's go for a coffee break."
A collection of my favorites (I hope someone actually reads this):
/**
* @file: getport.cpp
* @author:
*/
// No wonder he didn't write his name above this crap. I wouldn't.
// If we can't divide by zero, we have to use something very similar:
m = v / 0.0000000000000000000000000000000000000000000000000000001;
// window destructor
Window::~Window() {
// wait for the window to close, it's cold outside
pthread_join(thread1, NULL);
endwin();
}
Thread.Sleep(2000);
// This is for pure effect, the algorithm is so fast
// that no one would actually believe it
def AVeryCleverFunctionThatCalculatesIfTheNumberGivenByEntryWidgetIsReallyAPrimeNumberOrItIsDividableByAnotherNumberOtherThanFirstPlusNumberWhoseDistanceFromZeroIsEqualToOneOrByItself:
def parseRESData:
# pornhub.com
return FALSE;
Not even one of these is actually mine, but I consider them so freaking hilarious I have to share with you :-)
Thread.Sleep
get into C++? - Billy ONeal
For the rare occasion I need to raise exceptions, I have reserved a special identifier:
var up:Error = new Error();
throw up;
There are some comments that are fun but really useful. I remember one program made with C++ (Visual Studio 4 or 5) where I found the following comment (I translated it for the sake of clarity).
double x = 0.0; // DON´T TAKE THIS OFF!!!
Note that the variable x was not used anywhere. The funny part is that if you deleted the line the program did not compile anymore. The error? If I remember correct it was something about struct alignment.
My default new JSP text in eclipse used to read: "This is my JSP."
It now reads: "This is my JSP. There are many like it, but this one is mine."
This isn't really humor, but I find it funny. This is the fast inverse square root function from the Quake III source code. It uses some crazy hacks to get results that (at least, at the time) are up to four times faster than (float)(1.0/sqrt(x), even though sqrt is usually implemented in assembly.
Line 10 makes me laugh. Maybe it's just how ridiculous the whole thing is, and I can see John Carmack laughing while writing something so strange.
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
#ifndef Q3_VM
#ifdef __linux__
assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
return y;
}
Q: What do you call 8 hobbits ?
A: A hobbyte
via reddit [1]
[1] http://www.reddit.com/r/funny/comments/ctjy0/what_do_you_call_8_hobbits/#include"Magic.h"
Dear Computer
Please print "Hello World!" string
Then wait until user pressed a key
Best Regards
Programmer
...and this is magic.h
#include<stdio .h>
#include<conio .h>
#define a )
#define Best ;
#define Computer (void){
#define Dear void main
#define key ;
#define pressed (
#define Please printf
#define Programmer
#define print (
#define Regards }
#define string );
#define Then int
#define until =
#define user getch
#define wait x
do you like it? :)
I'll throw in random stuff when I'm working on a very difficult problem, due to my inability to think of appropriate variable names. I tend to try and tell a story to keep my excitement
$self = new User();
while($self->hungry()) {
$bacon = $pig.Substr(...);
$breakfast = getValue() + $bacon;
$self->feed($breakfast);
}
I sometimes use a pattern where a temp table has a boolean column named Kevorkian, initialized to true for all records. The process does some fancy dancing wherein records may be added, and Kevorkian may be set to false for certain existing records. Finally, a delete query removes all records where Kevorkian is still true.
I tried to think of a more serious name for a flag that means "after careful and mature consideration, this record still wishes to commit suicide" but Kevorkian was the best I could do.
-Al.
I don't know about anything funny.. but it's always a hoot to lie in your comments. Not little white lies, but huge blatant ones.
'//do not remove following code or app will stop running
Dim n as string
For n = 1 to 10000000
n = n & rnd()
Next
I really liked this one :
int OF_THE_JEDI = some value;
// code does something here with var
return OF_THE_JEDI;
I would say, stay away from humor in code unless your program is written in lolcode.
lolcode.com
Personally, I keep the comments straight forward and to the point... The svn check-in logs however... recently full of references to Dr. Horrible's Sing Along Blog.
This didn't directly relate to the code in the script, but I wrote a VBScript called psexecWizard. It basically called psexec en-mass based on some database criteria and did some other random/cool stuff. In between the functions, I made comparisons between psexecWizard and "Pinball Wizard". Other wizard references eventually cropped up (allusions to the Washington Wizards, Wizards of the Coast, and Harry Potter, boy wizard).
sample:
' Pinball Wizard was written by Pete Townshend of "The Who". Dan Coates* wrote PsExec_wizard. According ' to both authors, each item was "the most clumsy piece of writing [he'd] ever done." ' * Not the more famous Dan Coates that wrote "Lean on Me", but the less famous one who was in a ' a cappella group YouTube video performing Nintendo songs.
This wasn't used in any program, I just thought it was funny.
<?php
$iShower = $_GET['clean'];
if ($iShower) {
echo getdate();
}
?>
My test data for Gliffy's [1] API is all based on Simpsons and Futurama. For example, the account named "BurnsODyne" has diagrams like "Reactor Control UI", "Mayoral LAN", "SNPP Domain Mode", and "Booze Database Design". A personal account owned by "robotdevil@robothell.com" has a flowchart called "Circuitous Plan to Get Hands Back". Test data just has to be kept interesting. I actually made them realistic, too:
![SNPP Domain Model] (http://www.naildrivin5.com/davec/SNPP.jpg).
[1] http://www.gliffy.comSo this isn't directly answering the question - but definitely is good not to take yourself to seriously when you're programming - have a good time and don't worry - that proverbial next programmer will be smart enough to figrure out what's going on regardless your oddball sense of humor.
Had a senior project I was working on for my under-grad degree - we had a "project manager" who also participated in some of the coding. I was almost in tears when he took personallly a comment I made about "the stupid database" or something like that - he thought I needed counseling or something (not that I don't)... but again, let's not take ourselves to seriously, cause no one else does.. :)
There's a database connection manager class in one particularly horrid third party app I work on. Every instance is called "connman".
While I'm sure it wasn't intentional humor, it seems appropriate. Sometimes, especially late at night, we break out laughing when we come across one of these.
23, 42, 69
For extra obscurity, I sometimes convert them to hex before.
It might be funny in the code that you write, but it's maddening to debug someone else's code that's littered with this kind of trite.
A friend of mine wrote a program that would communicate with another via two pipes. One for each communication direction (send/receive). The variable that held the descriptor/handle for the pipe for receiving data was named "bagpipe".
One of my favourites that I have come across:
my $ofTheJedi = x;
return $ofTheJedi;
A certain project I worked on had a LOT of complicated, big-ball-of-mud [1] code. One of the older functions is prefixed by a quote from Through the Looking Glass:
/* "It seems very pretty," Alice said when she had finished it,
"but it's rather hard to understand! Somehow it seems
to fill my head with ideas--only I don't exactly know what they are!
*/
IMHO funny comments are OK, but funny-names or funny-values for variables are horrible:
-Why do we have a String
login_is_ok
and why does it contain "Listen, I'm not crazy ... yet"
?!?
+Well, one of the original developers thought it was funny, ROTFL-funny even.
-Aaargh!
The funniest thing I ever saw was in a c# application to replay captured drawings on the screen. In between the individual drawing of the samples of pen positions was a call to a function waitABit();
, which was defined as follows:
void waitABit()
{
for(int i = 0 ; i < 1000000 ; i++);
}
In java code of huge old application I saw quite funny comment
// Fellow, modify this method if you understand EVERY SINGLE LINE in it
In my younger days When writing one-off perl programs I admit I had a penchant for just emitting code with colloquial meanings like:
open(FOO,"...") or die horribly;
or
foo() until $hell_freezes_over;
Though, that said, I try to make very few cultural references in my code.
I had written some code that needed to know if the person reported last month had passed on during the month. I created the method ISeeDeadPeople(...) as bool
I can't resist adding a comment to this one
reader.Flush(); // after use
Just for fun, I named one of my methods as such:
tell_the_user_that_the_program_has_like_totally_finished_doing_its_thang_by_calling_this_butt_long_method_name_man
In a menu control i found the following comment
if (_isPage) // If you are a page, you are steril and can't have childrens
HasChildren = false;
Found on the web :
The human body in HTML & PHP
<human>
<head>
<hair /><br />
<ear align="left" />
<sight><eye align="left">
<eye align="right"></sight>
<ear align "right" /><br />
<nose /><br />
<form action="aliment.php"><mouth /></form><br />
<nect height="8cm" />
</head>
<body>
<tshirt style="background-color: #000000;" />
<arm align="left"><hand /></arm>
<chestarea><?php if ($sex=='female')
{echo '<tit align="left" /><tit align="right" />;}
else {echo '<nipple align="left" />
<nipple align="right" />;} ?></chestarea>
<arm align="right"><hand /></arm>
<br /><tummy><bellybutton /></tummy></tshirt>
<pants size="short"><underwear>
<?php include 'private.php'; ?></underwear></pants>
<leg align="left" />
<leg align="right" style="tattoo-image: url(img/alvago.gif);" />
<sneaker align="left" class="nike"><foot /></sneaker>
<sneaker align="right" class="nike"><foot /></sneaker>
</body>
</human>
Some code for sending emails
//Let's take care of the email body
StringBuilder bodyBuilder = new StringBuilder();
I tend to name temporary classes, scripts, and variables as "mattayu". As in:
public class Mattayu
{
... some temporary coding to be used and thrown away
}
I actually had someone ask once, "What's a 'mattayu'?"
To which the answer is, naturally, "What'sa matter me? What'sa matter YOU???"
I don't remember the exact original code and it no longer exists because it was a horrible hack but here's the story:
It was shipping date and we still had some "cleanup" to do, the final tests were running and only one, tiny bug was found by the tester: randomnly, when the user reloaded the application with the command "[app_name] reload" he couldn't get back the prompt and had to press Ctrl+C (the reloading worked fine, just the prompt didn't return sometimes).
The application was run by a bash script that managed more than one child process in the background, and to identify the current in scope process we named it as "me".
So we came up with the brilliant idea to kill the child process that do the reload after it was done:
doReloadInBackground
sleep(5) # Aproximately time taken to reload the application
kill $me # , please
It was a rather stressful day...
From the C++ standard headers included with Mingw (and perhaps others...)
basic_ios.h:
* @return A bit pattern (well, isn't everything?)
basic_string.h:
* Documentation? What's that?
I wrote baNdit [1], a Firefox extension that adds a lot of useful features to banniNation.com. One of the features is marking posts that have scores above a certain threshold with an image, or if you've told it to pay attention to a particular user, it'll mark the post with a different image. The name of the function that handles this is:
PublicDefenderChristineSullivan : function() {
Google it if you don't get the reference.
[1] https://addons.mozilla.org/en-US/firefox/addon/7936In FoxPro:
set bug on
or:
set bug off
die (Strings::get('Obituary') . $e->getMessage());
or
$validArchType = array ('A-Frame', ..., 'McMansion', ...);
or
define ('DEVIANCY_OR_MALFEASANCE', -1);
or
<string key="VICE_PRESIDENT">Just making sure Kathy is paying attention.</string>
I write for a lot of school districts. I tend to keep humor out of my code but my test database has the teachers as the actors that played the Doctor and the students as the various companions over the years.
At my employer, we've named our databases and some of the machines in your development environment after The Big Lebowski characters and common themes.
For instance...
"TheRug", "TheBriefcase", "Donny" and "Walter"
I won't elaborate on what is exactly named after the infamous rug, but I will say that it LITERALLY ties the room together...or in this context, our production environment.
I was writing a bejeweled clone, and I had functions for destroying (killing) and restoring (ressurecting) jewels from a pool. So I once wrote something like this:
Jewel* jesus = RessurectJew();
It's just a comment but I couldn't help myself.
def this_is_recrawl(config):
"""SPARTAAAAAA"""
if config.has_option("global", "recrawl"):
return config.getboolean("global", "recrawl"):
return False
An embedded programming assignment at Uni was broken into 2 segments, Control and Logging. I subsequently had the roll of logging, and in turn labeled all my files prefixed with AssLogging.c
We had a project whose title abbreviated to AU, so quite a few (private) functions were
gold_this() { ...}
or
gold_that() { ...}
after the chemical symbol ...
It was humour, although not particularly funny.
Geeky pop culture things. Like Johnathan Coulton songs, or an XKCD comic. Maybe an obscure video game reference (like Leroy Jenkins or something). Generally my source code humor comes from whatever tickles my fancy at the moment.
When ever I test a system that needs information about people I always use The Simpsons characters. There are lots of them and when I see
"Ned Flanders
132 Evergreen Terrace.
Springfield MA
I know it's one i created.
(yes, I know it's the wrong state but I'm from MA and it's a debatable issue)
It's also fun to see which of my co-workes notices it first.
Wow. Just wow. This thread is awesome. I personally like a bit of humour in code, it keeps me awake on those extra early mornings when the 9:30 scrum is a bit too early.
On my last job we had a particularly colourful couple of coders who liked to get subtle jabs in through the comments. My favourite was one that had an excellent swear density, about every 4th word, and a blatant statement that he a) did not want to write this code and b) we would be better off using another product.
I thought the swearing might be a bit much but hey that little chunk of code could get me through even the most boring meetings.
I came across a quite funny method, used seriously in the code, it made me laugh. :D. It did something, but it was hard to decipher what it did.
void Foo() {
// Some spaghetti code here
}
Apparently there was no method 'Bar', I was disappointed.
There's some code at work along the lines of:
date midnight midnight = date("8:00")
I worked with someone who put a variable named NotSoFastMonkeyBoy in the application. This popped up in an error message where some customers could see it. Management was not amused.
At the same place was a library for making multi-step wizards and named everything according to a wizard theme. Each page of the wizard was a spell, all the spells were in a grimoire, and the current page was pointed to by a wand.
I inject a number of things in code that only I think are funny. :)
For example, instead of naming an interface IPacketViewer, I might name it ISeePackets.
Theoretically, I could mention my children's names in method parameters, assuming I was using the Dependency Injection pattern.
I have a habit of making testing values the names of fictional countries. Leading to several co-workers playing "guess the movie" once.
Well, when just testing stuff out I used to name my command objects Arnold:) That and a lot of swearing in test strings:P
This is definitely not mine, but the Sun hme driver provides lots of fun!
http://kerneltrap.org/node/542
We have a series of scripts that manage our automated promotion process named Travis and Franz (for no particular reason aside from the whims of the programmer who named them), and a cleanup script named Alice (from the maid in the Brady Bunch).
I've never done it in code for work, but when I was in school I always enjoyed overly long acronyms for my app names. Also, recursive ones are fun. I named one MOOVIE - Movie Object Oriented Visual Information Exchange.
I like belittling my programmer-colleagues in my code comments. It makes me feel better, and also tells me whether anyone reads my comments.
Which reference sources do you think are more likely to be universally understood?
is not the right approach. Jokes are much more fun if not everyone understands them. It rewards those users that do and allows you to better jokes. That said, that can only be done in jokes that aren't too obtrusive. - Jasper