2010-10-13, 11:43 PM
Fiel Wrote:Variables should be lowercaseUppercase
Methods should be UppercaseUppercase
Global constants should be UPPERCASE
My programming style are: SomeClass for class name, function_name for function. As for variables, I usually do var_name. Constants are uppercase as you stated.
Alternatively, the function/method name start with lower and then Camel case after, eg thisIsAnExample. I exclusively have full camel case for class name only.
Ideally, you may want to have something like ClassName, variable_name, functionName so you can easily distinguish between them, tho some people hate underscores.
Another style many unix programmers tend to do is to have _classVariable for classwise variables. For the above case, you could have _verb for the class variable and verb for the function input. I used to do this, however, you may get collisions with some predefined variables, since most variables that are system related usually start with __ (2 underscores). To avoid the confusion, I usually lable my variables as input_verb (for the input of the function), clean_verb after you sanitize it.

