3 ms·
Uh, the example in the article is from a numerical computation, and following conventions (typically, from a book, or a research paper, etc) is often a good ide
by cema 14y ago
Uh, the example in the article is from a numerical computation, and following conventions (typically, from a book, or a research paper, etc) is often a good idea. Just as long as they are not confusing. An example would be using g for the gravitational constant. If they start becoming confusing, can take them out to a namespace (if the language allows it): just like Math/e is a better practice than e, so Physics/g could be better than g. As a previous comment (http://news.ycombinator.com/item?id=5157849 http://news.ycombinator.com/item?id=5157849) indicates, when used in a short piece of code, quick synonyms can be used, thus g instead of Physics/g (or Physics/Some_Longer_Name).
As mentioned elsewhere in this thread, short-lived names can often be short, too. In some cases they are little more than placeholders. An example is an index for a for-loop that is in fact a "for-each" loop when the language lacks the latter and the index does not have much of a meaning of its own.