12 Replies - 1944 Views - Last Post: 28 July 2013 - 03:23 PM Rate Topic: -----

#1 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 357
  • View blog
  • Posts: 2,768
  • 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: 43
  • 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 offline

  • Behind Seven Proxies!

Reputation: 410
  • View blog
  • Posts: 1,421
  • 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: 856
  • View blog
  • Posts: 2,246
  • 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: 43
  • 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: 357
  • View blog
  • Posts: 2,768
  • 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

  • Radar love
  • member icon

Reputation: 332
  • View blog
  • Posts: 1,419
  • 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: 7292
  • View blog
  • Posts: 12,099
  • 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: 385
  • View blog
  • Posts: 2,648
  • 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 Head

Reputation: 32
  • View blog
  • Posts: 240
  • 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: 186
  • 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: 52
  • 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
  • +
  • -

Page 1 of 1