as you can probably tell from my previous posts i have horrific naming conventions. do you know of any tutorials dealing with how to name stuff?
i will recommend to check this book http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=sr_1_1?s=books&ie=UTF8&qid=1281129036&sr=1-1
I don't think there will be any good tutorials, because there aren't any hard-and-fast rules. Here are some tips:
Conform to convention: Loop variables are i
, j
, and k
; variable numbers of arguments go in *args
and **kwargs
; use camelCase or underscored_names.
Be consistent.
Be concise. list_of_drugs_used_in_this_program
is much less clear than drugs
. Similarly, you don't need to include the datatype of the variable in the name: drugs_list
is redundant.
Don't go overboard with the underscores. I've never needed more than one. 2+ is pushing it.
Never ever ever use metasyntactic variables (foo
, spam
...) in anything but quick-and-dirty examples. method1
is also out.
But you could summarise all of that with:
Tee hee.
Variable naming conventions can often turn into a religious war, but I’m entirely confident when I declare The World’s Worst Variable Name to be:
$data
Of course it’s data! That’s what variables contain! That’s all they ever can contain. It’s like you’re packing up your belongings to move to a new house, and on the side of the box you write, in big black marker, “matter.”
http://www.oreillynet.com/onlamp/blog/2004/03/the_worlds_two_worst_variable.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With