Re:Should I Comment My Code? The Case Against Code Comments
by jordanhudgens on Thursday October 06, 2016 @09:06AM
(#12652073)
That's a great point, that can make a difference for when comments are applicable.
Some statically typed languages don't suffer from this particular problem of making types clear, so you will see comments less, and reserved more for cases where logic is hard to parse conceptually. But some static languages have a similar problem due to type inference, which causes commenting in the same fashion as a dynamic language.
I am of the school of thought that except for making types clear, the best way to comment your code is to make the code as clear as possible so that it is obvious without extra explanation. Often, you can refactor a clumsy or confusing piece of code in a way to make its intent clear.
But sometimes you cannot, and that's where comments come in.