4 ms·
You should try it with long names and without and let's see what is easy to understand. e^pii = -1 or theNatural....Constant... = theCircleConstant... theSq
by simion314 3y ago
You should try it with long names and without and let's see what is easy to understand.
e^pii = -1
or
theNatural....Constant... = theCircleConstant... theSqureRootOfMinusOne = minusOn
or maybe you replace One with theNeutralElementForMultiplication
but maybe someone is too lazy and you need to give a good clear name for what multiplication is,
Sorry, but I could not help it, I seen this kind of comments multiple time, some people want to jump to the middle or end of a book/course and skip the hard work.
- qumpis 3y agoThis is other side of extreme. And these constants are widely accepted notation.
- simion314 3y ago>This is other side of extreme. And these constants are widely accepted notation. Some dude will say that "i" is also used as the vector for the horizontal axis, i is sometimes used in induction as iterator too, so clearly it should be refactored to sqrtOfMinusOne. Also + and * are overloaded in math, so maybe they should be replaced with a clear name like "realNumberAdition"
- Freebytes 3y agoWhat you demonstrated as the "bad example" is closer to what mathematicians have been doing recently, but they would use natLog, ratCir, and im as variable names instead inside of a function called gnl() and offer no comments as to what any of it means. From what I have seen, they should likely be putting their code into ChatGPT and asking it to clean it up because it does a better job of writing functions with properly named variables.
- taneq 3y agoAaaargh! Prefixing identifiers with "the" or "my", especially combined with a type name (eg. "int myFirstInt = 3;") is a giant neon warning sign indicating that whoever named them is (a) fresh out of a beginners' course no matter how much calendar time has passed, and (b) they never properly grasped what an identifier is actually for. (I know these are examples and not what you personally would actually name them, but ugh what a visceral reaction. :P )
- simion314 3y agoSure, it was an example I would do something like const E = 2... const PI = 3.14 but the argument was that what if a random say train driver looks at my code, he will not know what E could be.