Camel naming, Pascal naming, and Hungary naming

Source: Internet
Author: User
Tags uppercase letter
Mydata is a Pascal naming method.
Mydata is a camel naming method. The first letter of the first word is lowercase, and the first letter of the next word is uppercase, which looks like a camel.
Imydata is a Hungarian name. Its lowercase I indicates its form. The latter name is the same as Pascal's, indicating the purpose of the variable.

 

I. Hungarian naming law : It is widely used in environments like Microsoft Windows.

The naming rules for variables (including macros) used in Windows programming are the Hungarian naming rules. This naming technology is developed by a competent Microsoft Program Proposed by Charles Simonyi.

The Hungarian naming method identifies the scope and type of the variable by adding the symbol of the corresponding lowercase letter before the variable name as the prefix. These symbols can be used at multiple times. The sequence is first M _ (member variable), then pointer, then simple data type, and then others. For example, m_lpszstr indicates a long pointer member variable pointing to a string ending with 0 characters.

The key to the Hungarian naming method is that the identifier name starts with one or more lower-case letters as the prefix. The prefix is followed by one or more words in the upper-case letters, this word indicates the purpose of the variable.

The prefix of frequently used lowercase letters in the Hungarian naming method:

Prefix type
Array)
B Boolean)
Byte)
C signed character (char)
CB unsigned characters (char byte, not many people)
Cr color reference value (colorref)
CX, Cy Coordinate Difference (length shortint)
DW double word
FN Function
H handle (handle)
I integer
L long integer (long INT)
LP long pointer
M _ class member
N short INTEGER (short INT)
NP near pointer
P pointer
S string type
String type ending with null in SZ (string with zero end)
W word


Ii. Camel naming:

The camel-style command method, as its name indicates, refers to the name of a variable and function, which is composed of uppercase and lowercase letters. For example, the following is the same function named by the camel naming method and the underline method respectively:

Printemployeepaychecks ();

Print_employee_paychecks ();

The first function name uses the camel naming method-each logical breakpoint in the function name is marked with an uppercase letter; the second function name uses the underline method-each logical breakpoint in the function name is marked with an underscore.

The camel naming method has become increasingly popular in recent years.
In an environment like Windows, it is widely used. On the other hand, the underline method became popular after the emergence of C. It is widely used in many old programs and UNIX environments.


Iii. Pascal naming:

Similar to the camel naming method. However, the trigger name is the first letter in lower case, while the Pascal name is the first letter in upper case.

For example, public void
Displayinfo ();

String username;

Both use the Pascal naming method.


In C #, Pascal naming and camel naming are mostly used.

 

Address: http://www.zouyang.net/post/220.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.