this post was submitted on 11 Jan 2026
319 points (93.2% liked)
Programmer Humor
28379 readers
1204 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Outside of the for loop counters i and j, short variable names are awful. Coming back to old code written with abr var nams is like talking to someone in the military who just constantly throws out jargon and acronyms that they know you don't know.
But so are Java style ObserverFactoryManagerTemplateMachinistTemplater names.
There's a sweet middle ground of short, but actually descriptive name. Sometimes it's not possible but that's usually a code organization / language / framework smell.
Too short variable names is usually a sign that you need to use a proper ide, with auto complete, or that you need to use a proper build process that will minify your code after the fact.
Too long names are usually a sign that your module of code (function, class, namespace, etc) is too large, or that your language/framework naming conventions are too strict, or the language doesn't encapsulate scope properly.
I’ve started to prefer writing it out as ”index” or ”iteration” even in for loop counters. It’s easier to read, and not much harder to type.
Keeping things that can be on one line to one line is a good reason to use short variable names where it won't be confusing. Writing "iteration" sounds absolutely perverse!
The thing is, everyone understands i and j. The reason calling variables hcv or iid is dumb is because noone knows what that means - quite a different situation.
I like it to make it clear when the for loop is about iterating lists and when it’s not. For example, the iterations in Monte Carlo algorithms doesn’t correspond to items in a list.