aspose file tools*
The moose likes Meaningless Drivel and the fly likes Funny Code comments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "Funny Code comments" Watch "Funny Code comments" New topic
Author

Funny Code comments

Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Greetings fellow ranchers !

What is the best comment in source code you have ever encountered in your programming career ? Either written by your-self or by any fellow programmer . Do share here everyone !


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

There is even an article about a comment that burned into my brain: Who is Gregor Samsa?

I didn't really enjoy it when I first saw it, since I've discovered it a similar way. But, in retrospect, it is funny!
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

hehehe :-D good one ! I came accoss this once

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1535
I have heard people writing Bollywood songs in code comments that pass code-review stages and go in production.!


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 1043
    
  13

Not a comment, but I once encountered a custom exception class called BlondeInputException.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

One of my friends had an internship in West Virginia and he came back with a bunch of fun comments in the local dialect, for example, at the end of a series of conditions intended to whittle out non-compliant conditions:


Personally, I pepper my code with whatever I'm reading at the time, for example, I just saw a comment of a particularly relevant XKCD Comic


[How To Ask Questions On JavaRanch]
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

BlondeInputException.


:-D


Another one I remember was something like this

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Way back in the Ice Ages when I was writing applications for Windows, I remember there was one section of code in an app that was the epitome of unreadable, unmaintainable, unintelligible code. It had been written by a long-since-departed contractor and was a crucial piece of the system that just about everything needed to use. It was riddled with bugs, but all the other code did ridiculous and over-complicated gyrations to get around the bugs, rather than anyone braving trying to fix the noxious code.

The comment on that block (I've saved it -- the comment, not the code -- to this day):


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Bear Bibeault wrote:

Which reminds me of this Dilpert Strip:

http://dilbert.com/strips/comic/2013-02-24/


Steve
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
I once saw, in production, live, out-in-the-world code:

x = 5; // set x to 5


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

it reminds me of another "mocking" comment I found in a C/C++ application back when I was a C developer

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Saif Asif wrote:it reminds me of another "mocking" comment I found in a C/C++ application back when I was a C developer



Source: http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Wow ! Now I know from where it ended up in our app !
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Another one
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Quite recently I came across this .

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Saif Asif wrote:Wow ! Now I know from where it ended up in our app !

Along with all the other ones you have quoted in this thread.
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1281



No Kaustubh No Fun, Know Kaustubh Know Fun..
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Recently saw this....
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6




Not in a comment, but I once ran across production code that essentially depended on that to work correctly. We received messages from a stock exchange with 1=buy and 2=sell, or something like that. The libraries we used transformed those into their own values--103 and 101 I believe.

Then one day I had to test a subset of the system in isolation. Where it had been exchange --> lib1 --> lib2 --> app, I changed it to simulator --> lib2 --> app. Everything broke. Horribly. After some digging I found out that all the simulated buys were being treated by the app as sells and vice versa. At first I freaked out, thinking we had a huge CF in production. After a moment I calmed down and realized that if that had been the case, there would have been screaming up and down the halls long ago.

After some digging, I found something like this:



So lib1 turned a buy into a sell, and lib2 turned it back into a buy, so that our app saw the semantics the exchange sent out, albeit via the scenic route. Two wrongs made a right and all was well, as long as we didn't try to separate lib1 from lib2, where the permanent crossing of the streams was the only thing that kept things working.
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1510
    
    5

Jeff's comment reminds me of a more horrible version:

Some more I've seen:






Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

Anayonkar Shivalkar wrote:

Someone apparently reads XKCD.
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1510
    
    5

Martin Vajsar wrote:Someone apparently reads XKCD.

Wow... I read that code on some forum (I guess StackOverFlow)
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

Once I was working on someone's else code ... had to fix it actually ... but as the time slot was really really short ... i just bunked it and put a comment

Something weird is happening here ... I don't what ...


http://plainoldjavaobject.blogspot.in
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

I remember writing this numerous times in my code. Even still I write it.

 
wood burning stoves
 
subject: Funny Code comments