4 ms·
> Every time you need to add a code comment you have failed to write clean code that it easy to understand. I find this to be a rather curious statement. I don
by sidlls 9y ago
> Every time you need to add a code comment you have failed to write clean code that it easy to understand.
I find this to be a rather curious statement. I don't believe "clean code" and "easy to understand" are necessarily related as strictly as you seem to.
Sometimes solutions to problems are messy and difficult to reason through with just the text of the solution ("code"). Code comments that elucidate meaning when the solution is thorny make code clean. The absence of comments might make code pure (in some sense), but not clean.
- kyberias 9y ago>> Every time you need to add a code comment you have failed to write clean code that it easy to understand. > I find this to be a rather curious statement. I don't believe "clean code" and "easy to understand" are necessarily related as strictly as you seem to. Well, if we select a definition for clean code to be what Robert C. Martin defines in his book "Clean Code", it very much is related to code that is maintainable, that is readable (i.e. easy to understand). I'm not saying they are "strictly" related as you seem to suggest I think. The absence of comments is not a necessary property of clean code. But the absence of unnecessary comments is. Most comments are unnecessary. Also, most importantly, the presence of comments is not a sufficient criteria for clean code. Code can be of very high quality without any comments. You seem to say that _good_ comments may improve the quality of code and I agree.