3 ms·
I see code comments as useful for two categories of things: 1) Information that is available by reading the code. In this case, the comments serve as a short-c
by piinbinary 8y ago
I see code comments as useful for two categories of things:
1) Information that is available by reading the code. In this case, the comments serve as a short-cut to understanding the code. They might be explaining what an obscure flag does, noting the name of the algorithm being implemented, or giving an overview of the structure of the code. You could learn that by reading the code, but reading the comment is faster.
2) Information that is _not_ available by reading the code (or is unlikely to be corrected derived by reading the code). For example, the reasoning behind decisions can only be guessed at by reading the code alone.