Camel nomenclature :
As its name suggests, it refers to the use of a mixture of upper and lower case letters to form the names of variables and functions. For example, here is the same function named using camel notation and underscore notation:
printEmployeePaychecks(); print_employee_paychecks(); |
The first function name uses camel nomenclature, and each logical breakpoint in the function name is marked with an uppercase letter; the second function name uses the underscore method, and each logical breakpoint in the function name Breakpoints are marked with an underscore.
Camel notation has become more and more popular in recent years, and it is used quite a lot in many new function libraries and environments such as Microsoft Windows. On the other hand, the underscore method became popular after the emergence of c. It is very commonly used in many old programs and environments such as UNIX.
Hungarian nomenclature :
widely used in environments like Microsoft Windows. The naming rule for variables (also including macros) used in Windows programming is Hungarian nomenclature. This naming technique was proposed by a capable Microsoft programmer, Charles Simonyi.
Hungarian nomenclature identifies the scope, type, etc. of the variable by prefixing it with the corresponding lowercase letter symbol in front of the variable name. These symbols can be used multiple times at the same time. The order is m_ (member variables) first, then pointers, then simple data types, and then others.
For example: m_lpszStr, represents a long pointer member variable pointing to a string ending with 0 characters.
The key to Hungarian nomenclature is: the name of the identifier starts with one or more lowercase letters as a prefix; the prefix is followed by a word or a combination of words with the first letter in capital letters, which should indicate the purpose of the variable.
Pascal nomenclature :
similar to camel nomenclature. It’s just that Camel nomenclature uses lowercase letters, while Pascal nomenclature uses capital letters, such as:
DisplayInfo(); string UserName; |
Both use Pascal nomenclature. In C#, Pascal nomenclature and camel nomenclature are the most common.
A summary of the three naming rules:
MyData is an example of Pascal nomenclature and myData is a camel nomenclature. The first letter of the first word is lowercase and the first letter of the following words is capitalized. It looks like a camel. iMyData is a Hungarian nomenclature. Its lowercase The i indicates its type, and the following ones are named the same as Pascal, indicating the purpose of the variable. |