Tagged Questions
47
votes
25answers
3k views
Where do you declare variables? The top of a method or when you need them?
I am in sort of a dilemma (in a geekish way of course).
I love to declare variables at the beginning of my methods, and usually order them in some logical way.
The problem is, when the list gets ...
37
votes
10answers
3k views
Should I reuse variables?
Should I reuse variables?
I know that many best practice say you should not do it, however later when different developer is debugging the code and have 3 variables that look a like and only ...
18
votes
8answers
506 views
Intentional misspellings to avoid reserved words
I often see code that include intentional misspellings of common words that for better or worse have become reserved words:
klass or clazz for class: Class clazz = ThisClass.class
kount for count in ...
4
votes
10answers
1k views
Variable names: underscores, no underscores, or camel case?
Variable names can be written in many ways, but the most common that I'm familiar with are:
thisisavariable,
this_is_a_variable, and
thisIsAVariable.
Which of these are preferred, and why?