Thursday, December 10, 2015

How to NOT comment your code

Researching for the yesterday's post ("Look, I am playing tennis" or how to document your code), I stumbled on a interesting topic, and that is "funny comments".

While initially the post advised against it, I found some that are really funny so I would like to list some of them here. While they are not useful, they do increase the quality of the code by making the other developers laugh.

But there is a danger that some might not get our humour so when in doubt, better don't add it.

* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.

// Dear maintainer:
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// total_hours_wasted_here = 42

Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha

//When I wrote this, only God and I understood what I was doing
//Now, God only knows

// sometimes I believe compiler ignores all my comments

// I dedicate all this code, all my work, to my wife, Darlene, who will 
// have to support me and our three children and the dog once it gets 
// released into the public.

// somedev1 -  6/7/02 Adding temporary tracking of Login screen
// somedev2 -  5/22/07 Temporary my ass

// drunk, fix later

// Magic. Do not touch.

#define TRUE FALSE //Happy debugging suckers

Catch (Exception e) {
 //who cares?

 * You may think you know what the following code does.
 * But you don't. Trust me.
 * Fiddle with it, and you'll spend many a sleepless
 * night cursing the moment you thought you'd be clever
 * enough to "optimize" the code below.
 * Now close this file and go play with something else.

//This code sucks, you know it and I know it.  
//Move on and call me an idiot later.

// I am not sure if we need this, but too scared to delete.
// I am not responsible of this code.
// They made me write it, against my will.

// I have to find a better job

// hack for ie browser (assuming that ie is a browser)

// If you’re reading this, that means you have been put in charge of my previous project.
// I am so, so sorry for you. God speed.

// If this code works, it was written by Paul. If not, I don’t know who wrote it

//You are not expected to understand this

// This is crap code but it’s 3 a.m. and I need to get this working.

// Abandon all hope, ye who enter here.

 From: here and here

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.