Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Funny Code comments

 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 440
Hibernate Eclipse IDE Linux
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hehehe :-D good one ! I came accoss this once

 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have heard people writing Bollywood songs in code comments that pass code-review stages and go in production.!
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a comment, but I once encountered a custom exception class called BlondeInputException.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

BlondeInputException.



:-D


Another one I remember was something like this

 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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):

 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:


Which reminds me of this Dilpert Strip:

http://dilbert.com/strips/comic/2013-02-24/
 
author
Posts: 9031
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I once saw, in production, live, out-in-the-world code:

x = 5; // set x to 5
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it reminds me of another "mocking" comment I found in a C/C++ application back when I was a C developer

 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow ! Now I know from where it ended up in our app !
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another one
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite recently I came across this .

 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Recently saw this....
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




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.
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff's comment reminds me of a more horrible version:

Some more I've seen:




 
Martin Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anayonkar Shivalkar wrote:


Someone apparently reads XKCD.
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Vajsar wrote:Someone apparently reads XKCD.


Wow... I read that code on some forum (I guess StackOverFlow)
 
Ranch Hand
Posts: 384
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ...

 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I remember writing this numerous times in my code. Even still I write it.

 
reply
    Bookmark Topic Watch Topic
  • New Topic