Thursday, 14 November 2013

Spice up your comments

I was searching for something on StackOverflow and found this off-topic thread on comments.
A few gems:

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

// 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

//Mr. Compiler, please do not read this.

// 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.

// drunk, fix later

// Magic. Do not touch.

return 1; # returns 1

// If I from the future read this I'll back in time and kill myself.

double penetration; // ouch

/////////////////////////////////////// this is a well commented line

// 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.

//Dear future me. Please forgive me. 
//I can't even begin to express how sorry I am. 

options.BatchSize = 300; //Madness? THIS IS SPARTA!

// I have to find a better job

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

} catch (PartInitException pie) {
// Mmm... pie

// John! If you'll svn remove this once more,
// I'll shut you, for God's sake!
// That piece of code is not “something strange”!

try {

catch (SQLException ex) {
// Basically, without saying too much, you're screwed. Royally and totally.
catch(Exception ex)
//If you thought you were screwed before, boy have I news for you!!!

// Catching exceptions is for communists

// 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.

* 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.

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

* If you don't understand this code, you should be flipping burgers instead.

//Abandon all hope yea who enter beyond this point

catch (Ex as Exception)
// oh crap, we should do something.

// TODO make this work

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