Hacker News new | past | comments | ask | show | jobs | submit login
The world's two worst variable names (oreillynet.com)
1 point by autotravis on March 26, 2013 | hide | past | favorite | 5 comments



I was expecting "foo" and "bar", honestly. At least things like "data" you can argue the point that the variable contains data (and thus at least isn't a counter or contain state).

Which is at least better than "foo".

My favorite though is still expletives as variable names. You can tell from the number of them just how frustrating the code was to write. I recall digging through some particularly hairy boot code a few years ago where /every/ variable name was a swear word. Must have given the developer fits to get working. :-)


No love for $x, $y, or $z?


In those cases, at least, there are some longstanding traditions that impart meaning to those names. Break those traditions at your own peril, but if you use them within the proper context, that's not a bad thing at all. The same applies to $i and $j.


Not when they're used in every context.


Well, yes, but I already covered that: if the names don't fit within the tradition that imparts meaning to them, then you need more descriptive names.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: