News for hackers. Stuff that matters.
Re:Ask HN: Organizing company knowledge? by dx034 on Wednesday April 11, 2018 @11:54AM (#16812381)
Not if the system fails on a Monday morning at 3am after 20 years without issues and needs to be fixed before the business opens. Having comments for every line helps fixing it dramatically.

For most code it will be overkill but there are some companies where it's integral for core systems.

Re:Ask HN: Organizing company knowledge? by Pamar on Wednesday April 11, 2018 @12:09PM (#16812563)
Honestly, these kind of problems are often due to unplanned/unexpected events (disk full, wrong permissions on a folder, OS updates correcting old bugs you have coded around) where having line-by-line comments would not help much if at all.

I would love to work in a place where documentation was cosidered a valuable asset, but I think that your example is off mark.

Re:Ask HN: Organizing company knowledge? by hellofunk on Wednesday April 11, 2018 @12:59PM (#16813114)
Sure but every line? You increment a loop counter, i+=1; and you say that in a comment?

The best rule of thumb is, make the code so clear that it is itself a comment, and only if the code cannot relay the meaning, then add a comment.

Re:Ask HN: Organizing company knowledge? by injvstice on Friday April 20, 2018 @03:01PM (#16887578)
Depending on the code, it can be freaking hard to track down what that 'i' means, especially when someone writes a coding standard (or a language) where it requires all variables to be defined at the beginning of the function instead of close to location of use.

on the other hand, if it was named something like number_of_records it would be clearer.

Re:Ask HN: Organizing company knowledge? by methyl on Wednesday April 11, 2018 @12:06PM (#16812531)
> Having comments for every line helps fixing it dramatically.

That’s only true if comments are kept up-to-date. More often than not, they get out of sync with the code itself, causing even more confusion.