r/dailyprogrammer • u/Coder_d00d 1 3 • Jul 28 '14
[Weekly #4] Variable Names
Variable Names:
We use variables a lot in our programs. Over the many years I have seen and been told a wide range of "accepted" use of names for variables. I always found the techniques/methods/reasons interesting and different.
What are some of your standards for naming variables?
Details like are they language specific (do you change between languages) are good to share. Or what causes the names to be as they are.
Last Week's Topic:
26
Upvotes
View all comments
Show parent comment
2
u/sagequeen Jul 29 '14
That's really smart. Was doing a project in C that was suuuuuuper messy as a final lab, and we had some global variables named x and y, as well as nested for-loops with x and y for a 2-D array, and sometimes just because we felt like it we used i and j instead for temporary variables in subroutines. About 75% through, my partner and I realized that the code was just confusing, so all of our x's and y's in the for loops were changed to i and j, but we had to make sure that it wasn't an instance where we wanted the global variable x and y. Took such a long time, would not recommend, follow this guys advice and do ii jj etc. Definitely learned a lesson from that one.