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:
[Weekly #3] (http://www.reddit.com/r/dailyprogrammer/comments/2bbvqp/weekly_3_favorite_data_structure/)
View all comments
35
u/skeeto -9 8 Jul 28 '14
open_database_listand, at the other extreme, short-lived loop variables are single letters,i,j, andk.with-open-file,first-name), where it's not a syntax issue.strinstead ofstringorleninstead oflength), though there are exceptions. Full words are easier to read, especially if you're using a well-designed domain specific language that reads similarly to natural language.pthread_*) as a way to group your identifiers.