QUESTION:
How should you handle compound words when programming?
Are there any good lists available online for developers of generally accepted technology-related compound words?
I can see how this is highly ambiguous, so should I just use common-sense?
EXAMPLE:
I would be inclined to do this:
filename NOT FileName
or
login NOT LogIn
However, the microsoft documentation indicates that filename is not compound. So I wonder, is there a more definitive source? See also, this english.stackexchange discussion
on filename.
Under the section “Capitalization Rules for Compound Words and Common Terms” located here: Microsoft .NET Capitalization Conventions only offers a limited introduction into the topic, and leaves it up to the developer to use their intuition with the rest.
2
In this case, it’s more important to set your own standard and follow it consistently. A lot of this is debatable between developers, so you should pick a method and use if consistently for each word. A dictionary is a good place to check to see if something is a valid single word.
As an aside, login is a noun (the login page) and log in (or LogIn) is a verb (log in the user). Here the distinction can be made by writing logIn
vs. login
1
I search in an english dictionary and both filename and login are single word terms. So in programming they should be treated as a single word, not compound words.
I guess an english dictionary should be a good source of reference.
3
I’m highly annoyed by inconsistent naming. I suggest these actions:
-
Create a project-wide dictionary for naming that resolves all the common cases, like “filename” and “login”. If you are going to allow any abbreviations, they should be standardized too, and if used at all, I suggest using them all the time.
-
Define a process to follow to resolve new questions about word breaks. For example, you could just defer to dictionary.com or another online dictionary.
-
Have code reviews to catch naming errors.
-
Publicly flog repeated scofflaws.