CamelCase Camel |
Historically, programmers have used three ways of joining multiple words into one variable name:
Hyphens:
first-name, last-name, master-card, inter-city.
Underscore:
first_name, last_name, master_card, inter_city.
Camel Case:
FirstName, LastName, MasterCard, InterCity.
First time I've run into Camel Case. Underscore is popular. It requires using the shift key, but so do capital letters. Two issues are readability versus compactness. Leaving out the underscore makes a word more compact. I'm not sure how readable Camel Case is. It's certainly better than all lower case. I've run into a several ambiguous URL's the last few days. They were written in all lowercase letters. Wish I had recorded them, but I didn't, and I certainly don't remember them.
Don't think I've ever run into hyphenated names in programming. Every programming language I've dealt with treats hyphens as a minus sign, so master-card means subtract the value of variable card from the variable master.
No comments:
Post a Comment