64
stacked
7y

Anybody else here has a coworker who insists on having comments everywhere and writes code like this?

// Get foo
foo = getFoo();

// Check if foo is greater than bar
if (foo > bar)

Or is it just me?

Comments
  • 2
    I think it's fairly common. Some of them don't know what to write so they just explain obvious functions, some of them start and then lose concentration when 'harder' (thinking required) stuff comes along. And then there's this fucker:
  • 7
    Failed to upload image, can't edit after 5min so here's my example of 'useful' comment
  • 4
    My company doesn't allows comments anywhere
  • 0
    Code style guides fix this.
  • 3
  • 1
    I think I'm just a little guilty of this
  • 0
    @LicensedCrime it's not mine of course, I just have to look at it :D
  • 5
    Start of project: You know what, I'm gonna fill this with documentation, examples, and comments!

    Middle of project: Well, we don't need a comment for EVERYTHING...

    End of project: What does this function do again?
  • 0
    Says the guy who never comments his code
  • 3
    My teacher was like that in college, when he said comment everything he wasn't joking, he literally commented every peice of code in the end you could bearly understand or see the code itself.
  • 1
    At work we have to rule of no comments.
  • 2
    My code looks like that sometimes, if i do new stuff, that ive not done before then i often write the comments before o Code, like planning the stuff. Haha
  • 0
    @Salmakis Yeah, I did that all the time when I first started programming, trying to remember all the basic functions.
  • 5
    Comments should show why something is done, not what is done
  • 1
    NightGenie is correct. Plus, code should be self explaning by naming variables right. And comments are a second copy of code so they are redundant
  • 0
    @Lensflare it depends, sometimes frameworks, Interfaces and stuff we use are just not so well named as theyr should be. A small coment that just tells whats going on can make it more easy to understand for strangers
  • 2
    That's so stupid. Not only does it clutter the code making it less readable it's duplicating knowledge which is never a good idea in coding.

    When, not if but WHEN, you change the code but forget to change the comments you will have a comment that is lying. So in the future you might spend a lot of time investigating this comment and wondering why the code is not doing as the comment says. Eventually you find out the comment is a lie and voila - you have spent two hours on achieving NOT A SINGLE FUCKING THING!

    Tell your idiot co-worker he/she is making life harder for his/her colleagues and should stop immediately.
  • 1
    @simeg you're absolutely right about wrong/obsolete comments, and in fact this happens all the time with him
  • 0
    @stacked have you brought this up as a problem with him or with management?
  • 1
    @simeg there are other, more important problems that need to be solved right now
  • 0
    @krlooss debugging must be hell!
  • 0
    @digitaldina The person reviewing my code always removes the comments I put to it, claiming that "we don't need that" 😮.
Add Comment