Tagged Questions
93
votes
16answers
18k views
Is there an excuse for short variable names?
This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't ...
68
votes
17answers
13k views
What is the benefit of not using Hungarian notation?
One of the things I struggle with is not using Hungarian notation. I don't want to have to go to the variable definition just to see what type it is. When a project gets extensive, it's nice to be ...
59
votes
6answers
3k views
Should the variable be named Id or ID?
This is a bit pedantic, but I've seen some people use Id as in:
private int userId;
public int getUserId();
and others use:
private int userID;
public int getUserID();
Is one of these a better ...
25
votes
9answers
934 views
Scientific evidence that supports using long variable names instead of abbreviations?
Is there any scientific evidence that the human brain can read and understand fully written variable names better/faster than abbreviated ones?
Like
PersistenceManager persistenceManager;
in ...
22
votes
9answers
857 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 ...
17
votes
6answers
829 views
What are the benefits of prefixing function parameter names with p*?
I often see projects (in Java projects and teams using Eclipse) that prefix function parameters with p.
For example
public void filter (Result pResult) ...
I personally don't see any benefit in ...
16
votes
6answers
602 views
“A”, “an”, and “the” in method and function names: What's your take?
I'm sure many of us have seen method names like this at one point or another:
UploadTheFileToTheServerPlease
CreateATemporaryFile
WriteTheRecordToTheDatabase
ResetTheSystemClock
That is, method ...
16
votes
7answers
3k views
Practical considerations for HTML / CSS naming conventions (syntax) [closed]
Question: what are the practical considerations for the syntax in class and id values?
Note that I'm not asking about the semantics, i.e. the actual words that are being used, as for example ...
13
votes
8answers
1k views
A Class named Class?
This is more of a style question, but it is something I am currently pondering for a project of mine.
Assume that you're creating an application which is modeling a school. So there are entities like ...
8
votes
4answers
352 views
How to avoid general names for abstract classes?
In general it's good to avoid words like "handle" or "process" as part of routine names and class names, unless you are dealing with (e.g.) file handles or (e.g.) unix processes. However abstract ...
5
votes
10answers
2k 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?
5
votes
2answers
234 views
What are the names for various forms of camel-case style naming?
For the purposes of communicating coding styles to my co-workers, what would I formally call the following variants of camel case?
camelCase
and
CamelCase
Notice that the former version ...
4
votes
6answers
327 views
Order of subject and modifiers in variable names
I'm looking for experiences regarding the ordering of the subject and modifiers in variable names.
A simple object Shape would have just a subject for the variable name, such as Area.
A slightly ...
3
votes
3answers
173 views
How to name an subclass that add a minor, detailed thing?
What is the most concise (yet descriptive) way of naming a subclass that only add a specific minor thing to the parent? I encountered this case a lot in WPF, where sometime I have to add a small ...
1
vote
2answers
213 views
Choosing between words with different spellings for function names
A question has been bothering me for a while: when developing international projects, it is common sense to use English as the reference language since it is the language that the most people ...