Worst Code Comments Ever

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 4540 Views - Last Post: 08 July 2015 - 07:46 AM Rate Topic: -----

#1 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 450
  • View blog
  • Posts: 3,114
  • Joined: 18-September 06

Worst Code Comments Ever

Posted 08 July 2013 - 06:06 AM

Not sure if we have somewhere for this kind of thing. If we do, could a mod kindly move this please?

Basically, I was thinking that we needed someplace to put those really clever comments you find in other people's code, like this one:

            End While
            'end of while



Has anyone else seen any good ones?
Is This A Good Question/Topic? 1
  • +

Replies To: Worst Code Comments Ever

#2 Secretmapper  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 20-July 12

Re: Worst Code Comments Ever

Posted 08 July 2013 - 06:45 AM

There was this one time I remember working for a government firm. The code was a big mess and the functions themselves are hard to understand, since it was some scientific geology kind of stuff, things I wasn't keen on.

The problem was there are lots of things edited, commented out, removed, and it's generally one big convoluted piece of junk that managed to do what it was supposed to do.

There were things like

//compute soil consistency function
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

and there is basically blank after that.

But the worst was this complete black-box of a function whose meant to be used with an API but is only commented like:

//Input necessary values

And there was like a gazzilion parameters that were all weird and scientific.
Was This Post Helpful? 0
  • +
  • -

#3 depricated  Icon User is online

  • Conversion Software Version 7.0


Reputation: 1234
  • View blog
  • Posts: 3,977
  • Joined: 13-September 08

Re: Worst Code Comments Ever

Posted 08 July 2013 - 07:04 AM

Maybe Nightmare in Code?

Found this today

Public Sub testSoap()
    
    'gooby please
    
End Sub

Was This Post Helpful? 1
  • +
  • -

#4 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 902
  • View blog
  • Posts: 2,349
  • Joined: 28-March 11

Re: Worst Code Comments Ever

Posted 08 July 2013 - 07:22 AM

away to Nightmare.In.Code we go....
Was This Post Helpful? 1
  • +
  • -

#5 Secretmapper  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 20-July 12

Re: Worst Code Comments Ever

Posted 08 July 2013 - 07:26 AM

Quote

away to Nightmare.In.Code we go....


Ooooh... I never realised there was this side of the forums. I'm quite dense especially since I'm posting in it.

Thanks, def useful, even if one quick peek in the whole forums could have made me see it :D
Was This Post Helpful? 0
  • +
  • -

#6 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 450
  • View blog
  • Posts: 3,114
  • Joined: 18-September 06

Re: Worst Code Comments Ever

Posted 08 July 2013 - 07:32 AM

Thanks Gunner :)

That's a good one Dep.
Was This Post Helpful? 0
  • +
  • -

#7 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 378
  • View blog
  • Posts: 1,571
  • Joined: 08-April 09

Re: Worst Code Comments Ever

Posted 10 July 2013 - 07:44 AM

I find myself doing exactly that saying to myself "I'm gonna change that to something meaningful later" but forgot :(
Was This Post Helpful? 0
  • +
  • -

#8 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 8763
  • View blog
  • Posts: 15,082
  • Joined: 19-March 11

Re: Worst Code Comments Ever

Posted 10 July 2013 - 08:12 AM

View PostMichael26, on 10 July 2013 - 09:44 AM, said:

I find myself doing exactly that saying to myself "I'm gonna change that to something meaningful later" but forgot :(/>



There's a lot of people who write the comments first, for exactly that reason. At least that way, if you forget to include something, people know what you meant to include!
Was This Post Helpful? 0
  • +
  • -

#9 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 516
  • View blog
  • Posts: 3,458
  • Joined: 12-January 10

Re: Worst Code Comments Ever

Posted 10 July 2013 - 08:22 AM

found this little diddy in one of codes today



some function()

'no trouble found in variable
'i dont understand the variable names so I am just pretending I do
 


Was This Post Helpful? 0
  • +
  • -

#10 Adam27X  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-July 13

Re: Worst Code Comments Ever

Posted 13 July 2013 - 08:59 PM

if(var =/*=*/ dyn_cast<SomeType>(oldvar))


^Interesting, but dangerous.

Also, obligatory SO thread: http://stackoverflow...ver-encountered
Was This Post Helpful? 0
  • +
  • -

#11 DblAAssassin  Icon User is offline

  • D.I.C Regular

Reputation: 40
  • View blog
  • Posts: 300
  • Joined: 11-May 13

Re: Worst Code Comments Ever

Posted 16 July 2013 - 04:43 PM

View PostBort, on 08 July 2013 - 06:06 AM, said:

Not sure if we have somewhere for this kind of thing. If we do, could a mod kindly move this please?

Basically, I was thinking that we needed someplace to put those really clever comments you find in other people's code, like this one:

            End While
            'end of while



Has anyone else seen any good ones?



View Postdepricated, on 08 July 2013 - 07:04 AM, said:

Maybe Nightmare in Code?

Found this today

Public Sub testSoap()
    
    'gooby please
    
End Sub



View PostDarenR, on 10 July 2013 - 08:22 AM, said:

found this little diddy in one of codes today



some function()

'no trouble found in variable
'i dont understand the variable names so I am just pretending I do
 



Just Curious... Are these all PHP? I've never coded in PHP, so don't call me an idiot if it's not.
Was This Post Helpful? 0
  • +
  • -

#12 Witchking  Icon User is offline

  • D.I.C Head

Reputation: 68
  • View blog
  • Posts: 189
  • Joined: 17-February 13

Re: Worst Code Comments Ever

Posted 16 July 2013 - 04:59 PM

View PostDblAAssassin, on 17 July 2013 - 01:43 AM, said:

Just Curious... Are these all PHP? I've never coded in PHP, so don't call me an idiot if it's not.

PHP syntax resembles the C style. This looks like Visual Basic.
Was This Post Helpful? 0
  • +
  • -

#13 sam_writes_code  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 59
  • Joined: 05-November 12

Re: Worst Code Comments Ever

Posted 28 July 2013 - 03:23 PM

View PostBort, on 08 July 2013 - 01:06 PM, said:

Not sure if we have somewhere for this kind of thing. If we do, could a mod kindly move this please?

Basically, I was thinking that we needed someplace to put those really clever comments you find in other people's code, like this one:

            End While
            'end of while



Has anyone else seen any good ones?


I admit that I do that sometimes, but I try to add a bit more like:

//	Check if num1 is less than num2
if(num1 < num2){
	//	Do something meaningful here
}
//	End of If (num1 less than num2)



They're there for when I'm just scanning through the code. Most of them get removed when I'm cleaning up.
Was This Post Helpful? 0
  • +
  • -

#14 Orthoducks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 27-June 13

Re: Worst Code Comments Ever

Posted 14 June 2015 - 10:10 PM

This happened on my second job out of college, when really big mainframes had a megabyte of RAM, some shops were still writing business applications in Basic Assembly Language, and dinosaurs roamed the Earth.

I was hired to write programs that sucked data from tapes submitted by the company's clients and loaded it into a database. Yes, the programs were all written in BAL.

I hadn't been there long when I was assigned to modify a program written by one of the company's handful of senior programmers. He was a nice enough guy, but he had a juvenile sense of humor and an exaggerated idea of his own abilities.

When I looked at the program, I found the usual stuff: save registers; load data conversion library; open file on the input tape. Then the start of the main loop, graced with the label BACK.

BACK? I wondered. Why BACK? I assumed it meant something, but I couldn't imagine what.

I got my answer when I reached the end of the program and found a branch instruction that referred to the label BACK, with this comment:

         B     BACK            TO THE BEGINNING AND DO IT AGAIN


"Branch back to the beginning and do it again!" Oooh! Clev-er!
Was This Post Helpful? 0
  • +
  • -

#15 ndc85430  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 211
  • View blog
  • Posts: 822
  • Joined: 13-June 14

Re: Worst Code Comments Ever

Posted 14 June 2015 - 10:36 PM

One of the comments in our codebase is

# This is not Sparta

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2