Elegant Programming: The Art of Naming (Part 1)
— Give all entities mentioned in the code (DB tables, DB tables’ fields, variables, classes, functions, etc.) meaningful, descriptive names that make the code easily understood. The names should be so self-explanatory that it eliminates the need for comments in most cases.
Use the words per and by as often as possible – they really simplify a developer’s life. A variable’s name li_cows_per_farm is better than li_total_cows, and a function name uf_retrieve_city_by_country tells us more than uf_retrieve_city, especially if it doesn’t have parameters that supply the “by what” information…
I really like… not, reading through code where variables are named @var1, @aa, temporary tables #temp, #t1. When I need to touch such code, I have “a bad habit” of renaming those, re-indenting the code, if necessary, in case there are mixed tabs with spaces, unify them, basically leave the code in a little better shape than I’ve welcomed it.
I’m waiting for next part by Michael.