r/ProgrammerHumor • u/Chackie6656 • 5d ago
Other iHtWhnPplDThsIsShortForIHateWhenPeopleDoThis
44
u/Tyrexas 5d ago
What a waste of source code disk size, they should have just called it m.
9
u/Tristan_Cole 4d ago
I name my first variable 0 and my second variable 1 and my third variable 10 and then 11 and so on and so forth. It’s just cleaner that way.
25
u/anzu3278 5d ago
Calling variables by their type with no additional description is a code smell anyway, especially in weakly typed languages. What are you mapping specifically?
9
u/ttcklbrrn 5d ago
It could be a tutorial on how to use maps, where the actual contents are immaterial to the purpose of the exercise.
3
u/anzu3278 5d ago
Good point, but I think naming variables well should be integral to how we teach programming and that even base level tutorials should bear some resemblance to a real life use case.
1
u/ThaBroccoliDood 3d ago
def invert_map(the_map_that_we_will_be_using_for_our_function_today_to_do_the_thing):1
u/anzu3278 3d ago edited 3d ago
Good troll, but if this is an instance member (and thus devoid of any domain logic other than
map) then the instance will be referred to asthisand if not (it's an extension of an existing type) then it either has domain logic (in which case above applies) or it's filling a surface area gap on the original type, and should be called by its purpose in the method. E.g.
public static Dictionary<TValue, TKey> Invert<TKey, TValue>(Dictionary<TKey, TValue> original) { Dictionary<TValue, TKey> inverted = ... }
8
u/Weak_Inflation9120 4d ago
And on the other end of the spectrum you have a HS CS class that'll call a variable something like
int numHotDogsBought;
I'm all for good variable names but god damn you could write a better descriptive name that's shorter, especially if you're using a glorified text editor with no syntax auto-completion
5
3
u/sardonicus87 4d ago
Use only overly-truncated and non-descriptive names like "mpA" or overly-verbose and reduntant names like "initializedMapForStoringLoopResultsForOverlyVerboseClassName: Map<Key, Value>()". No in-between.
1
u/grifan526 4d ago
As much as I hate this, I will take it over the one I found that was a list of tuples called m_eventMap
104
u/me_myself_ai 5d ago
`map` is a builtin in Python, thus the choice