3 ms·
The right name for a variable is related to what you think the way people will check it will be. In most code the attestation to the correctness of the code is
by whatshisface 5y ago
The right name for a variable is related to what you think the way people will check it will be. In most code the attestation to the correctness of the code is the programmer's understanding of the code. Clearly then names should be descriptive. In contrast, when the attestation to the correctness of a formula is that it is the same as a formula printed in a published paper, then it should look as much like the formula in the paper as possible. A programmer who does not know that rho means density will not be able to catch scientific misconceptions by virtue of the fact that they see the word "density." On the other hand, the will be able to catch differences between the symbols in the source material and the source code.
In any code you write, you should be asking, "how will people check this?" If the answer is "by comparing it to something else," then it should resemble the original as much as possible. If the answer is "by thinking about it," then it should be formatted for self-contained comprehensibility. The distinct use cases lead to different best practices.