An unofficial blog that watches Google's attempts to move your operating system online since 2005. Not affiliated with Google.

Send your tips to gostips@gmail.com.

July 15, 2006

A Collection Of Funny Source Code

Funny things seen in source code and documentation is a page that contains:

Some funny stories

Once I had a junior programmer writing VB code that needed to know the day of the week. He decided to write his own code, and read something like:

if (day = 1) or (day = 8) or (day = 15) or (day = 22) or (day = 29) then
weekday = "Monday"
elseif (day = 2) or (day = 9) or (day = 16) or (day = 23) or (day = 30) then
weekday = "Tuesday"
...

Trying to be educational I asked him for his opinion about his own code, and he said that he would simply modify it every month.


... and some angry comments

// Either the app is exiting or the world is coming to an end.
// Take your pick.

// I'd trade my office mate for a layout manager.

/* PB, is this right? -- AW */

// Everything is shamelessly stolen and rewritten.
// Feel the consequences of GPL ;-)


... and some hilarious errors

% tar cvf foo.tar
tar: Cowardly refusing to create an empty archive

In the middle of something innocuous, an angry message box appeared:

Dammit, Darin! I told you not to call me!


// TODO: Don't forget to write something funny and add a warning that some jokes (replace with: a lot of jokes) may be hard to understand for non-programmers.

// This text was posted by an automated script.

9 comments:

  1. haha, those source code snippets were amazing!

    I tend to put funny comments in my code as well.
    Once we were making a java class to handle errors in a card reader.
    This one class was dealing with a card jam, comment to decribe it
    /*Card reader got greedy*/
    Its true though.
    Thats only one of many strange comments i've added, not to mention code...

    Favourite code on that page was:
    ; /* If you think this is a mistake, think again. */
    I think thats pretty hilarious!

    ReplyDelete
  2. great! for much more funny source code comments -> http://www.codecandies.com

    ReplyDelete
  3. That junior programmer must be an Indian

    ReplyDelete
  4. indians are far better programmers than others....

    ReplyDelete
  5. Hi all,
    I published first version of http://www.geakets.com where you can write funny code and let others discuss it.
    I'm planning to have weekly competitions in future. Site is open sourced at github and I might need some design help. :)

    ReplyDelete
  6. @Mark : Y should he be Indian? Have you got something against the country?! Try looking up the staff records in Microsoft, Apple, Dell, Intel.. You name it.. You'll find many gifted programmers, many with patents to their names (which is Obviously more than you can claim for yourself!). So, try NOT to be a racist Pig.. which may be hard for a dick like you- but try anyway..

    ReplyDelete
  7. i've had code written by indians. nothing special let me assure you.

    ReplyDelete
  8. // Everything is shamelessly stolen and rewritten.
    // Feel the consequences of GPL ;-)

    this is hilarious

    ReplyDelete