5 ms·
It seems most coders agree that variables, functions, files, columns, classes, etc. should have unambiguous, explicit, names. Writing `m[k] = v;` would not pass
by underwater 6y ago
It seems most coders agree that variables, functions, files, columns, classes, etc. should have unambiguous, explicit, names. Writing `m[k] = v;` would not pass many code reviews. I don't see what makes generic types any different.
- another-dave 6y agoContext matters too though — As a general rule "i" is a terrible name for a variable but in a simple unnested loop it's expected. All these shorthands (e.g. K,V = Key,Value) have to be learned so should be used sparingly but in some places I think having shorthands for things like generics & indices allow boilerplate code to "get out of the way" of the business logic. You expend less mental energy trying to keep track of "i" (as you know it's a simple loop counter) than "index". And reducing cognitive load is the point of having descriptive names in the first place.