Blog & News

# Top 10 Programmer Jokes, Explained for the Rest of Us

Ahhhh…programmer humor! Hilarious to coders and completely baffling to the rest of us. Not a programmer?  Thanks to our very own Development Manager, Christian, you can be in on the jokes, too. He was kind enough to explain the punchlines of the following programmer jokes, for those of us who are dazed and confused. (UPDATE, binary jokes are now my favorite.)

### 1. Why do programmers always mix up Halloween and Christmas? Because Oct 31 = Dec 25.

The joke here is that Octal 31 (which abbreviated looks like October 31st, Halloween) is equal to Decimal 25 (which abbreviated looks like December 25th, Christmas).

Decimal and octal are two number systems with different bases.

Decimal is the base-10 number system that everyone is familiar with. A number system has as many digits as its base number. That means a base-10 number system 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) and is where it gets its name from (decimal, from Latin decimus, means tenth).

When you get to a number that is higher than the highest digit, you add another column to the left, so you count like 8, 9, 10, 11, 12, and so on.

Octal (from the Latin root oct- meaning eight) is a base-8 number system commonly used in programming. A base-8 system means it has 8 digits (0, 1, 2, 3, 4, 5, 6, and 7). When you get to a number higher than 7, you also add another column, so you count like 6, 7, 10, 11, 12, and so on.

If we convert the octal 31 to decimal, we end up with 25. Watch: if we break octal 31 out to a math equation, it ends up being 3 x 81 + 1 x 80 = 3 x 8 + 1 x 1 = 24 + 1 = decimal 25.

To convert the other way, you start with the biggest power of the base (8, in this case) you can divide by and get a whole number, then take that and divide the remainder by the next smaller power until you get to the 0-th power. Then you just combine the digits together. In the case of 25, we need to start at 81: 25 / 81 = 3, remainder of 1 / 80 = 1, so 31.

### 2. There are 10 types of people in this world. Those who understand binary and those who don’t.

This is a binary joke; binary being a base-2 system. Since it is a base-2 system, it has only 2 digits, 0 and 1.

If we convert binary 10 to decimal, we get: 1 * 21 + 0 * 20 = 1 * 2 + 0 = 2.

So, the joke means “There are two types of people. Those who understand binary and those who don’t.”

If you don’t understand binary though, you’d think there are ten types of people, which would be weird.

In addition to decimal (base-10), octal (base-8) and binary (base-2), hexadecimal (base-16) is also used commonly in programming. It uses the letters A, B, C, D, E, and F as the “digits” above 9.

### 3. There are two ways to write error-free programs; only the third one works.

This joke refers to the fact that it is actually impossible to write an error-free program.

It is possible to write a program that seems to have no errors, usually referred to as “bugs” in programmer lingo, but Lubarsky’s Law of Cybernetic Entomology states “There is always one more bug.” The bug may be so tiny and under such specific conditions that you’ll never see it… but there is always one more bug.

Since there is always one more bug, the joke says only the third, non-existent method is the only way to write an error-free program.

### 4. The best thing about a Boolean is even if you are wrong, you are only off by a bit.

A Boolean is a data type which can only have one of two possible values: true and false.

A data type just means what type of data is held within something like a variable.

Variables in programming are similar to variables you might have seen in math class, with the difference being that a variable in programming can represent more than just a number. It could, for example, hold an alphabetic character like “c” or a whole word or phrase like “Hello World”, commonly called a string or a Boolean.

Booleans are typically stored within a bit, which is the smallest amount of storage in a computer. It holds a single binary digit. Binary, being a base-2 number system, means it can only hold the value 0 or 1. In the case a Boolean, 0 usually means false while 1 is usually used for true.

The joke then, is that if you have a Boolean, the most you can be off is a bit, which would just be 0 or 1.

### 5. A good programmer is someone who always looks both ways before crossing a one-way street.

This joke refers to the fact that, as a programmer, you can’t make assumptions about how things will behave in your program and always have to check everything.

For example, if you ask a user to type in a number, a good programmer won’t just assume what the user entered is a number. They need to check that what they got is actually a number and not a word or symbol or was left blank. Then, they need to check to make sure that the number is within the range that they were expecting (for example, -3 wouldn’t be a valid value for “How many people are attending?”).

Thus, the joke refers to the fact that they programmer can’t just assume because the road is one-way that everyone is going to follow that rule.

## 6. Debugging: Removing the needles from the haystack.

Debugging is the process in which you remove bugs from your program. Since finding bugs (and their causes) can frequently be tricky, finding them is like finding a needle in a haystack.

So, debugging is like removing the needles from a haystack (your program).

## 7.

The image is the answer to the question “How do you annoy a web developer?” If you look at the gray characters before and after the question, you see “<div>” and “</span>”. These are known as “tags” in HTML, the language used to make all websites.

Tags usually have an opening and closing tag. The opening tag is the name of the tag wrapped in <> (sometimes along with extra information). The closing tag is then the same name as the opening tag, with a / before it.

With the question, “<div>Q: How do you annoy a web developer?</div>”, “<span>Q: How do you annoy a web developer?</span>”, and “<div><span>Q: How do you annoy a web developer?</span></div>” would all be valid options. Mixing the two up is however not, and any good web developer would want to fix.

Thus, it’s quite annoying.

## 8.

In this joke, his teacher probably gave him the punishment “Write ‘I will not throw paper airplanes in class.’ on the board 500 times.”

Jason, the blonde student, thought he’d be clever and write a C++ program on the board which would do that for him.

The program looks like this:

#include <stdio.h>
int main(void)
{
int count;
for (count = 1; count <= 500; count++)
printf(“I will not throw paper airplanes in class.”);
return 0;
}

The first line is something you usually need to include in all of your programs in C++. It basically tells the compiler (the program which takes the text of your program and converts it into a program itself) to include some extra built-in features for your program (the stdio library, short for standard I/O or standard input-output).

The next line declares the “main” function. A function is basically a chunk of code which you can use multiple times. In C++, all programs must have a function named “main” which is the very first function which will be called when the program starts. The “int” means it needs to return an integer (which is a whole number). “Returning” a value means this function will tell whatever function called it that value when it is done running. The “void” means it needs to be given nothing.

The next line, the open curly bracket (also known as an open brace) pairs with the last line, the closing curly bracket (or close brace) to indicate a block of code. Which belongs to whatever came before the open curly bracket (in this case, the main function).

After that, we have “int count;”. This is declaring a variable (a container for information, much like a variable in algebra) which is of type “int”, meaning count will contain an integer (a whole number). The semi-colon (;) indicates the end of a command.

The next line: “for (count = 1; count <= 500; count++)” is a for-loop. A loop means it’ll run whatever command it is given for some number of times. In this case, we have “count = 1;” which tells us that count will start out being equal to 1. “count <= 500;” then tells us “keep going while count is less than or equal to 500”. Finally, “count++” tells us that after we do the command the for-loop contains, increment (increase by one) the value of count.

In the case of this program, the for-loop only has one command: “printf(“I will not throw paper airplanes in class.”);”. If it contained more than one line, it would have its own pair of curly brackets wrapping them up. This line tells the program to print the phrase “I will not throw paper airplnes in class.” Since it is in the for-loop which counts from 1 to 500, adding one each time, it’ll get printed 500 times.

Finally, the “return 0;” just means the program returns the integer 0 (because the main function line said it would).

Thus, understanding the program, we can infer the punishment his teacher gave him… and why she does not appear to be amused.

## 9. The best method for accelerating a computer is the one that boosts it by 9.8 m/s2.

This isn’t some much a computer joke as it is a physics joke.

9.8 m/s2 (9.8 meters per second squared) is the constant at which Earth’s gravity accelerates objects towards its surface. That means if you dropped something in a vacuum (which means there is no air, since the air will actually make the object fall slower), every second it will be going 9.8 meters faster than it was the previous second.

Basically, this joke means if you are having trouble with a slow computer, the fastest way to accelerate it is to throw it out the window or otherwise drop it from a high height.

Please note, this is of course a joke. Throwing your computer will actually only result in a broken computer. =)

## 10.

This joke has to do with SQL, which are commands used to control databases as well as a common hack used against insecure sites, called SQL Injection.

The basic idea is that when you have something where a user can type something (like a login form), you would take that input and use it in a query, a SQL command. However, if you don’t sanitize the input, or clean it of unwanted values, that user can do something malicious.

Take for example this query “SELECT * FROM users WHERE username = \$user AND password = \$password”. Normally, this would look up the user who’s username is stored in the \$user variable and password is stored in the \$password variable. So, if I entered “Bob” and “cookiesareyummy”, it would get those values and look like this: “SELECT * FROM users WHERE username = ‘Bob’ AND password = ‘cookiesareyummy’”.

That’s all well and good. However, if I wanted to be a bit malicious I could say my username was “Bob’; —”. This would then make the query “SELECT * FROM users WHERE username = ‘Bob’; –’ AND password = ‘cookiesareyummy’”. The semi-colon (;) means it is the end of the query and the # means anything after it is just a comment, which is code that is ignored. This little exploit could allow me to log in as anyone, without knowing there password. In good systems, you’d want to sanitize the input, which would change all of the characters in a way which this wouldn’t work.

This particular mom did something even more devious. By naming her son “Robert’); DROP TABLE Students; –“ she added in an extra command. This one “DROP TABLE Students” would drop (or delete) the table (set of data) which contains all of the information about all of the students.

Guess this school learned the hard way about needing to sanitize their input.

That’s all folks! Now you’re officially “in the loop.” Yes. That was another programming pun. Let us Google that for you!

A programmer’s wife tells him: “Run to the store and pick up a loaf of bread. And if they have eggs, get a dozen”
The programmer comes home with 12 loaves of bread

Popular Posts

Channels

Authors