3 ms·
There is definitely a balance, but high-level code, when well written, is self-documenting. Comments should justify why something has been coded the way it has,
by MrMatt 17y ago
There is definitely a balance, but high-level code, when well written, is self-documenting. Comments should justify why something has been coded the way it has, not tell others what the code does (unless it's justifiably unreadable).
- gaius 17y agoYes comments should be about intent, the implementation (code) should be obvious. Often when maintaining legacy code the most important thing is to understand what the original programmer wanted to do and why. Not that there aren't some complete idiots writing code - but you can't know that this seemingly stupid thing you see in your editor window wasn't the best decision at the time given some constraint that no longer exists now.
- eru 17y agoSome deep algorithms may require more comments about their inner workings.