Why Hashtable is not PascalCase?
I strongly try to follow general rules in coding styles. But when i look at .NET, i see that some of classes doesn't match PascalCasing rules. One of them is Hashtable
and the other one which i remember is Stopwatch
. I think there are more which i don't remember them.
Is there a reason to leave PascalCasing rules for those classe开发者_如何学JAVAs ?
Because they are both dictionary words.
You probably need a technical dictionary for hashtable, but stopwatch is a legitimate word.
PascalCasing is for cases where you combine different words to the name of your class (* and such), it isn't concerned with the linguistic origin of the word.
Thats mostly old code and not by purpose. Some would call it a mistake. Imo Stopwatch is correctly cased (stopwatch vs hash table, notice the blank).
Funny note: javas Hashtable is not PascalCase either while the new HashMap is (here im sure it was a mistake as josh bloch says so in effective java afaik)
It is not a "hash table" but a "hashtable" (as far as I know), so the PascalCasing of that word would then be accurate. Same for "stopwatch". Could be wrong about hashtable though..
精彩评论