How many ridiculous 56 code comments have you written?

Programmer's humor (ID: humor1024) finishing

I came here uninvited,

Give everyone a wave of God's commentary

For the entertainment of donors

0.

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

dear maintainer

If you try to 'optimize' this program

and you've realized what a terrible mistake this is,

Please increase the number of the following counters to warn others

Total time wasted here = 73

1.

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

Exception = new Exception("There is indeed a problem.")

give up; // lol

2.

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

As I write this only God and I know what I'm doing

now only god knows

3.

// sometimes I believe compiler ignores all my comments
copy

Sometimes, I would trust the compiler to ignore all my annotations

4.

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

I dedicate this code to my wife, Darlene, for always supporting me, my three children, and my dog.

5.

// drunk, fix later
copy

Drink too much, fix it another day

6.

// Magic. Do not touch.
copy

magic! do not touch.

7.

// I'm sorry.
copy

Feel sorry.

8.

return 1; # returns 1
copy

return 1; # return 1

9.

Catch (Exception e) {
//who cares?
}
copy

catch(exception e)

who cares?

10.

/**
* Always returns true.
*/
public boolean isAvailable() {
return false;
}
copy

Code returns false , annotations always return true

11.

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

You may believe you can read the following code,

But it's absolutely impossible, trust me.

Once you've debugged it, you'll absolutely regret trying to be smart about optimizing this code.

The best way is to close the file,

Go play something you like!

12.

try {
} finally { // should never happen
}
copy

definitely won't run here

13.

const int TEN=10; // As if the value of 10 will fluctuate...
copy

It seems like the value of 10 fluctuates...

14.

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

This code really sucks, and I know you know it too,

Don't scold me yet, please read on

15.

// If this comment is removed the program will blow up
copy

If you delete the comment here, the program will explode

16.

// I am not responsible of this code.
// They made me write it, against my will.
copy

I am not responsible for this code

They forced me to write, against my will.

17.

/* Please work */
copy

please work

18.

// no comments for you
// it was hard to write
// so it should be hard to read
copy

no comment,

hard to write,

So it should be hard to read

19.

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

Are you crazy? This is Sparta!

20.

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

If this code works, Paul DiLascia wrote it

Otherwise, I don't know who wrote it

21.

// Peter wrote this, nobody knows what it does, don't change it!
copy

This is what Peter wrote, no one knows what it does, don't change it!

22.

/** Logger */
private Logger logger = Logger.getLogger();
copy

No matter how hard you try, people get hurt when they get hurt. by Haruki Murakami

23.

// I have to find a better job
copy

i have to find a better job

24.

// Real programmers don't comment their code. 
// If it was hard to write, 
// it should be hard to understand.
copy

Real programmers don't comment their code.

if it is difficult to write

should be incomprehensible

25.

// This is black magic
// from
// *Some stackoverlow link
// Don't play with magic, it can BITE.
copy

This is black magic from stackoverlow

Don't play magic, it will bite

26.

// For the sins I am about to commit, may James Gosling forgive me
copy

I hope James Gosling will forgive me for the crime I am about to commit

27.

// Comment this later
copy

comment on this later

28.

// Remove this if you wanna be fired
copy

delete it if you want to get fired

29.

}catch(Exception ex){
// Houston, we have a problem
}
copy

Houston, we have a question

30.

// I can't divide with zero, so I have to divide with something very similar 
result = number / 0.00000000000001.
copy

I can't divide by 0, so I'm dividing by a very similar number

31.

int getRandomNumber()
{
Return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
copy

Choose by fair roll of the dice

guaranteed to be random

32.

#TODO: Figure out what I'm doing here and comment accordingly.
copy

Figure out what to do here and add comments accordingly

33.

// If this code is still being used when it stops working, then
// you have my permission to shoot me. Oh, you won't be able
// to - I'll be dead...
copy

If this code was still in use when it stopped working,

kill me, oh~ you can't do that

I am dead......

34.

// If you are reading this, that means you have been put in charge of my previous project.
// I am sorry, so sorry for you. Godspeed.
copy

If you see this, it means you have been appointed as the lead of my previous project.

I'm sorry, I'm so sorry. Good luck.

35.

// I wrote this while drunk, I don't know what it does, 
// but if you remove it the program breaks.
copy

I wrote this while I was drunk, so no idea what it's for

But if you remove it, the program breaks

36.

// This code worked before, but my cat decided to take a 
// trip across my keyboard...
copy

This code used to work, but my cat decided to make a trip to my keyboard

37.

long long ago; /* in a galaxy far far away */
copy

Far, far out in the galaxy (it's an absolute miracle that this code works)

38.

long john; // silver
copy

treasure island

39.

#define TRUE FALSE // Happy debugging suckers
copy

Happy to debug your code, haha

40.

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

Future dear me, please forgive me

i can't express how sorry i am

41.

// private instance variable for storing age
public static int age;
copy

Private instance variable to store age

42.

// I am not sure why this works but it fixes the problem.
copy

I don't know why this worked, but it fixed the problem

43.

last = first; /* Biblical reference */
copy

The end is the beginning, bible quote

44.

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!!!
}
copy

Needless to say, basically you're screwed

45.

// 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"!
// That is THE AUTH VALIDATION.
copy

if you delete again

For god's sake I'm gonna shut you down

This code is not some "strange thing"

that is authentication

46.

long time; /* know C */
copy

It took a long time to know

47.

// Abandon all hope ye who enter beyond this point
copy

Those who enter this gate end hope

48.

/* Ah ah ah! You'll never understand why this one works. */
copy

Ahhh! You'll never understand why this method works

49.

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

shit we should do something

50.

// TODO make this work
copy

do this with TODO

51.

// If you're reading this, then my program is probably a success
copy

If you are reading this code carefully and in detail now, there should be no problem with writing this code

52.

// set break point here - you'll never reach it
copy

Set breakpoints here - you'll never be perfect

53.

/*
**    The author disclaims copyright to this source code.
**    In place of a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
*/
copy

The author waives copyright in this source code

This is a blessing, not a legal notice

May you do good and not evil.

May you forgive yourself and forgive others

May you share freely and never give more than you give

54.

// I'm not sure what I did
copy

i'm not sure what i did

55.

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

This is crap but it's 3am and I need it to work

Past recommendation

Still using Random to generate random numbers? Try ThreadLocalRandom, super easy to use!

A question about hashCode!

Message idempotence (deduplication) general solution, really top!

Spring Boot 2.x Basic Tutorial: Fragmentation Configuration Using Elastic Job

The strongest code generator platform, killing crazy!

If you like this article, please forward it, follow me and subscribe for more exciting

Follow me and reply to "Add group" to join the Spring technology exchange group

Tags: Programmer Optimize Exception

Posted by missy3434 on Tue, 04 Apr 2023 12:18:09 +0530