16
RadX
6y

I'm a contractor at a product company and today I had the pleasure of working with some jQuery.

A function needed to be called before another function, hard work right?

So I moved the call to the function 3 rows higher, checked it in, set the task as ready for test and started to look for other tasks.
Within a couple of minutes I get a direct message from another dev, let's call him Steve.
Steve wanted me to set the task to ready for code review instead of test, so I did just that and tried to move on.

Some minute or two later Steve contacts me again:
"It would be great if you'd move the comment so it'd be over the call to the function"

Well, I'm not one of those who likes comments... If you need a comment, it's probably not good/readable code. In some cases sure, it might be a complex block coming up.
Sorry, lost my train of thought.

I answered Steve : "Are you sure, I could just remove it instead?"

(for readability S will be Steve and M will be me)

S: Well, it's always good to have comments
M: In this case I think it will be alright.
S: But it's nice to see what the function is doing.
M: I'll do it if you really want me to.
S: It's better to have the comment than to not have it and needing it.
M: Okay then

The name of the function : LoadOrganizationTree()

And this is the comment :
//Load organization tree

Comments
  • 0
    @Torbuntu the thing is, the comment is actually

    "//Ladda organisationsträd"

    Which is swedish... I probably should have included that in the rant ;)
  • 0
    @Torbuntu

    Indeed, the comment is completely rubbish. It doesn't say anything and that's why I wanted to remove it.

    However, the client wants to keep it ;)
  • 3
    It's always "meh, I don't need comments, this is self-explanatory" at first.

    Please remember that you're not the only one who needs to understand the code. The intern they'll bring in two years from now, when you no longer work there, will have to understand the code. Your boss will have to understand the code when he decides whether to promote you or not.

    You lose nothing by adding a line or two of explanation, and it can save hours of time in the future.
  • 0
    @Ileonichwiesz

    Absolutely, if I made a function that does stuff and someone mentioned that I didn't comment it, I wouldn't be ranting about it.

    But, revisiting a task to move a completely redundant comment that was written 5+ years ago and doesn't say anything at all about the function makes me question priorities
  • 1
    No spaces after //? You're a monster!
  • 1
    Svensk? Ta min uppbåt!
Add Comment