Have you ever found yourself maintaining the code of a long-gone programmer, trying to work out what the heck they were thinking about, only to find the situation eased by the use of some humour in the code which helped make things clearer? And I don't just mean in the code...
A lifetime ago, I was working in a company which developed alot of mainframe applications for internal use. This was a shoestring operation some of the time, and a lot of systems were designed to be reasonably robust, but not bulletproof. If something bad happened, the techies could deal with it. Bad things happened reasonably often, and needed some manual intervention to sort it out. While you were sorting it out, it was vital to prevent the user from making things worse by attempting to work around the problem. If somoene ran into a problem, you wanted to stop them from going any further until you got the issue resolved.
This was in the days of mainframes and dumb terminals. Each user had a single session, and couldn't just pop open a new window to log in again. The company philosophy was that when something bad happened, you gave the user as much diagnostic info as you could and then dropped into an infinite loop which kept their session busy. When you had resolved the problem, you killed the session and they logged in again.
I don't want to start a debate on the merits of this approach - like I said, it was a long time ago and far away. I just found the relevant code quite witty. In PHP it might look something like this:
define ("DOOMSDAY", "FALSE");
while (!DOOMSDAY){
// do nothing
}
except this wasn't PHP, and the while loop above became
REPEAT UNTIL DOOMSDAY
which always made me smile.
It became better when some wag surreptitiously introduced a new standard of
REPEAT UNTIL PAYDAY
Any other examples of amusing code, or am I just revealing myself to be a complete geek here?