blog_roll2

Part II: Top 10 Programmer Jokes, Explained for the Rest of Us

Last week, our Development Manager, Christian, broke down some of his favorite programmer jokes for us non-programmers. Check out Part I here.

Today, we present you with Part II!

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.

       

(Source: http://xkcd.com)

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.

 

(Foxtrot, copyright Bill Amend, 2003)

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.

 Exploits of a Mom

(Source: http://xkcd.com/327/)

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!

Have another programming joke to share? Post it in the comments!