Ask HN: Anyone know any funny programming jokes?

740 points by arthurcolle ↗ HN
Can be super esoteric or super generalized, I love it when I get them, or when I just learn something new.

904 comments

[ 3.1 ms ] story [ 390 ms ] thread
There are only two problems in programming...

Naming things, cache eviction, and off by one errors

There are only two hard problems in computer science:

0) Cache invalidation 1) Naming things 5) Asynchronous callbacks 2) Off-by-one errors 3) Scope creep 6) Bounds checking

There are only two hard problems in distributed systems:

2. Exactly-once delivery

1. Guaranteed order of messages

2. Exactly-once delivery

Reminds me of

There are only 2 hard things about programming:

- Cache invalidation

- Naming things

- Off-by-one errors

Cache invalidation isn’t hard, but it used to be and now we can’t get people to think otherwise.
I heard that the two main problems in computer science is that we have only one joke and it's not very funny.
cache invalidation is not hard indeed, but people always forget about it (so caches aren't caches aanymore, they become stale copies of things...). People tend to forget that a cache has to have a fixed size and an eviction policy.
How many Prolog programmers does it take to change a lightbulb?

:- False

Can Prolog be used to create AI?

:- No.

This is my GOTO programming joke.
Why do Java programmers wear glasses? Because they don't C#.
There are 10 kinds of people in the world: those who understand binary and those who don't.
The hex version is good too -

There are 16 types of people in the world: those who understand hexadecimal and F the rest.

(comment deleted)
The real answer is:

Those who don't understand binary

Those that think its a binary joke

Those who understand trinary

no no it is:

Those who don't understand binary

Those that think its a binary joke

Those that think its a trinary joke

Those who understand base 4

...

(comment deleted)
One can generalize this joke and use mathematical Induction to tell infinite jokes.
A human and a alien are talking about their number systems

Human: Oh, I see you use base 4. We use base 10.

Alien: WTF is base 4? We use base 10.

Those who don't understand binary, those that do, and those who count in Gray codes.
There are 10 kinds of people in the world:

Those who understand little-endian notation.

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.

(quote from Jamie Zawinski)

Definition of Recursion:- see Recursion
Loop, Infinite: see Infinite Loop

Infinite Loop: see Loop, Infinite

recursion, n. See tail recursion.

tail recursion, n. See tail recursion.

Why do programmers wear costumes to Christmas parties? Because DEC 25 = OCT 31.
Damn 0o31 actually does equal 25, that's great. Evidence of simulation theory, clearly ;)
A boy and a girl are sitting next to each other in a Java Computer Science class.

The boy reaches over and starts going through the girls purse.

The girl says: "Hey! That's private!"

The boy replies: "But we're in the same class!"

C++:

Friends can access each other's private members in a public class.

C programmer vs Java programmer

— Your Java is slow!

— This is because it is written in C!

A programmer had a problem. He thought to himself: "I know, I'll solve this with threads!"

has Now problems. two he

Then he thought he'd use Java. Now he has a ProblemFactory.
This is funny because no one uses the factory pattern in other languages
You'd be surprised to see how many WhateverFactory classes there are in the current python project I'm working on... sigh.
Using FactoryBoy for testing?
Well, to a first approximation, no, nobody uses the factory pattern in other languages.

Once in a long while you see one in C# or C++. But the people making fun of Java aren't comparing it with C# and C++.

I used C/C++ for years, and I just don't believe that the world+dog quit creational design patterns. It was just now very easy to find a database connection pool for C++ that is exactly a connection factory. Would you mind clarifying your comment that almost nobody uses factory patterns in other languages with some sense of exactness as to what is and what isn't a factory?
Reminds me of the old FactoryFactoryFactory joke [1]

[1] https://gist.github.com/nkbt/4691b1ae3e78a6141aea

> "This thing comes with documentation, right?"

This is the most painful part for me. If you're trying to understand some code written in Gratuitous Object Astronautics style, it's almost universally assumed you're fully aware of why the product contains hammer factory factory factories, how factories work, and how get an actual hammer to swing.

The Gratuitous Object Astronautics culture is so accustomed to all the nonfunctional boilerplate that skilled, self-gratifying, astronauts never need to document their cleverness. This leaves casual tourists in the dark, which is a problem in any organization.

This one always bugs me because it says "two" but this output couldn't be produced with fewer than 3 threads.
Fair point if you read it literally and assume each thread is a problem. But I assume, as it's a variation of the regex joke, 'using threads' is seen as a singular thing. Perhaps it should say 'threading?'
Hello, would you like to hear a TCP joke?

Yes, I'd like to hear a TCP joke.

OK, I'll tell you a TCP joke.

OK, I'll hear a TCP joke.

Are you ready to hear a TCP joke?

Yes, I am ready to hear a TCP joke.

OK, I'm about to send the TCP joke. It will last 10 seconds, it has two characters, it does not have a setting, it ends with a punchline.

OK, I'm ready to hear the TCP joke that will last 10 seconds, has two characters, does not have a setting and will end with a punchline.

I'm sorry, your connection has timed out...

Hello, would you like to hear a TCP joke?

(Credits to whoever first came up with this.)

I would say UTP joke but i am not sure if anyone catch it.
You've got a twisted sense of humor.
"HEY, DOES ANYBODY KNOW A GOOD ARP JOKE?"
Did you know that Javascript programmers are giving up double quote strings for Lint?
Here's one from the olden days...

Q: How are programmers like card machines? A: With both you have to punch the information in.

I heard a variant of this from musicians -- why is a drummer like a drum machine ...
I would tell you a joke about UDP, but you might not get it
You wouldn't care if he got it anyway
My favourite:

"What do we want?"

"Now!"

"When do we want it?"

"Fewer race conditions!"

Besides being a great joke, it explains the concept perfectly.
What do we want?

Time Travel!

When do we want it?

Doesn't matter!

This actually is very clever!
A QA engineer walks into a bar and orders a beer.

She orders 2 beers.

She orders 0 beers.

She orders -1 beers.

She orders a lizard.

She orders a NULLPTR.

She tries to leave without paying.

Satisfied, she declares the bar ready for business. The first customer comes in an orders a beer. They finish their drink, and then ask where the bathroom is.

The bar explodes.

(comment deleted)
Not a programmer, but this is good.
If you mean you're not a programmer, rad, good compliment. If you mean QA engineers aren't programmers... wtaf?
It's weird how some people admit they still test code by hand
I mean, I’m a programmer and I still test code manually. I’m not sure why it has to be xor
If “by hand” you mean using your hands to type code that generates tests, then yes, I admit to testing code by hand.
It's very simple: you test things because we can't rely 100% on developers to create the right thing or to create it without any bugs. The same goes for automated test software. I've personally created unit tests that were failing for like 2 years but due to a bug still showed green in CI.

To go back to the joke: manual QA is infinitely more likely to find the exploding bathroom than a unit test would ;)

Automated testing is a fantastic tool, but manual QA is still very valuable.

All my tests are individually hand-crafted from sapient pearwood and proctored by a licensed pirate.
It's not an either/or though. Used to have an assignment where we as developers would write automated tests (regression tests), while we had an experienced software tester with an excel sheet verifying things by hand. But instead of just following the sheet - which is automatable - he knew of a number of different techniques and approaches and he'd still find a lot of issues that nobody else found. For which we'd write a test to avoid it happening again.

I mean I wouldn't have minded if they wrote more automated tests themselves, but I'm also very aware that the mindset of me and developers would quickly become "it's not my responsibility to test my software".

QA is more than running tests by hand you could also just code.
Automated test suites suffer from the same problem.
It's weird how many bugs I regularly find in our software by actually testing things by hand, as opposed to our QA department, which does only automated testing and insists they have covered 100% use-case scenarios.
> test code by hand

Personally, I find it helpful to bugger out things with pen and paper before coding it out. This is helpful and useful.

Greatness to you of you need not the analogue. Others "below you" may and can do just as well. Please do not down your nose upon such folks.

(comment deleted)
This is the first one that made me laugh out loud. My kids came over, “Can I see?” to which I replied “I’m a giant nerd.”
This describes our qa team accurately
I just came up with a variation to this off the top of my head.

A QA engineer walks into a bar. She orders a beer. She walks out of the bar. She walks into the bar. She walks into the bar. She walks out of the bar. She walks out of the bar. She walks out of the bar. She orders a beer.

I recommend The Codeless Code, a series of humorous programming-themed Buddhist koans.

http://thecodelesscode.com/contents

I actually read all of them. Why they stopped adding new ones? Any similiar list of programming koans?
(comment deleted)
(comment deleted)
If programming seems hard, it might be because you need to learn a separate discipline depending on the order of magnitude of your codebase LOC:

10⁰: Axiomatics

10¹: Logic

10²: Mathematics

10³: Computer Science

10⁴: Software Engineering

10⁵: Group Psychology

10⁶: Politics

10⁷: Crisis Management

(comment deleted)
A Markov chain trained on CS textbooks and the Bible.

https://kingjamesprogramming.tumblr.com/

Some of these are pure gold!

"2:4 And this I pray, that your love may abound yet more and more like a controlled use of shared memory."

> 25:34 But the field of computer science and AI research. All attracted bright people who contributed great things to the church

The Church of Skynet demands sacrifice

5:5 And, behold, I will deliver you up to the programmer tendency to build overelaborate castles of abstractions.
Working on the lower levels, I have to wholeheartedly agree:

> Depart ye; it is unclean; thou shalt burn it in the place of Tophet, because of all the machine registers

#ifdef GET_A_HEARING_AID

(From the Bad C Pun Contest, 1992, C/C++ User's Journal. I've never forgotten it.)

XML is like violence: if it doesn't solve your problem, you're not using enough of it.