Expressing intent only though code is lossy.
If it is accepted that a reason to weed though someone else’s code is to find and remove bugs, how can the argument “the code is self describing” stand? The original intent has clearly become partially lost due to a defect.
There are at least two cases that exist in the presence of a defect:
- The original intent is described through the code.
- The original intent was improperly transcribed into code.
Without comments or some other mechanism to state intent, the two cases are indistinguishable. The first case is a much larger concern (i.e. risk) than is the second since it has the implication that other decisions were based on a flawed intent.
When a “code is self commenting” programmer is also a “crafty” programmer, you have the recipe for disaster. A crafty programmer is one that attempts to use small tricks such as over using a variable (e.g. a null value implies some other value does not exist) to achieve a goal. The problem with the resulting code is that the intent is obfucated. Anyone else reading the code typically has to scratch their head and wonder “is this intentional or a bug?”. Information about the intent is clearly lost in the translation to code.