Saturday, 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.

No comments:

Post a Comment