Developer’s personalities shine in odd ways. One them is in a (sometimes) subtle sense of humor, choice of words and attitude that you can find in code, code comments, and error messages. It often feels like a stream of consciousness that reflects the human reality of a moment in time.
I collect those gems and here I am sharing with you some of my favorites. Some I found myself in the code I worked with. Others, I collected from various sources. All have been stripped of anything that could be considered IP.
1 – Wild Compiler.
1 2 3 4 5 6 7 8 | /* * I don't know why the compiler hates me. * I changed this comment many times, and every * time it generated the same executable. * You should try. It's wild. */ |
2 – If You Get Here.
1 2 3 4 5 6 7 8 | /* * If you get here, I screwed up. * If I screwed up, I clearly don't know what I am doing. * If I don't know what I am doing, and you are looking at my code... * ...we are both in trouble. */ |
3 – Classic, Useless Documentation.
1 2 3 | int i = 0; // Set i to zero. |
4 – Whatever You Do, I Can Do Better.
1 2 3 4 5 | int getRandomNumber() { return(rand()+1); // You have been one-upped } |
5 – Don’t Even Try.
1 2 3 4 5 6 7 | /* * Don't even try to understand this. * I wrote it, and I have no idea why it works. * But it does. My subconscious is that good. */ |
6 – Feeling Sick.
1 2 3 4 | Exception up = new Exception("Something is really wrong."); throw up; // ha ha |
7 – CUI (Coding Under the Influence).
1 2 3 | // drunk, fix later |
8 – No Comment
1 2 3 4 5 6 | /* * Sorry, I have removed all comments from this code. * If you can't understand it, you shoudn't touch it anyway. */ |
9 – Sincerely
1 2 3 4 5 | public boolean thisCodeSucks() { return true; // sincerely } |
10 – Random Number
1 2 3 4 5 | int getRandomNumber() { return 4; // Guaranteed to be random. I used a dice. } |
11 – So Long
Not code, but still really funny.
12 – Human Needs
This is taken from the Apple Chess Engine code.
1 2 3 4 5 6 7 8 9 10 11 12 | // // Paradoxically enough, moving as quickly as possible is // not necessarily desirable. Users tend to get frustrated // once they realize how little time their Mac really spends // to crush them at low levels. In the interest of promoting // harmonious Human - Machine relations, we enforce minimum // response times. // const NSTimeInterval kInteractiveDelay = 2.0; const NSTimeInterval kAutomaticDelay = 4.0; |
13 – Textbook Comment
1 2 3 4 5 | /* * Explanation omitted as an exercise for the reader. */ |
14 – Expiring Code
1 2 3 4 5 6 7 8 | // If you are reading this after 1/1/2010 // there's something wrong. // This should have been ripped out by then. if (DateTime.Now > new DateTime(2010, 1, 1)) { throw new Exception("This code is now obsolete"); } |
15 – “Temporary” Code
1 2 3 4 | // somedev1 - 6/7/02 Adding temporary tracking of Login screen // somedev2 - 5/22/07 Temporary my ass |
16 – Family Issues
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * The game of life */ if (status==SINGLE) { money = 1; } elsif (status==DIVORCING) { money = money / 2; } elsif (status==DIVORCED) { money = money * 2; } else { // status==MARRIED money = rand() * monthly_salary + 0; // Savings is represented by zero. } |
nice one 🙂
Great stuff!
Thank you!!