"HTML" "11" Function name constraint specification

Source: Internet
Author: User

I. Hungarian nomenclature: [Not recommended]
The basic principle is : variable name = attribute + Type + object description, where each object name requires a clear meaning, you can take the full name of the object or part of the name. Based on principles that are easy to remember and easy to understand. It is very important to ensure the consistency of the name.

For example, if the name of the form is form, then it can be abbreviated to FRM in the nomenclature, then the full name of the variable should be frmswitchboard when the form variable is named switchboard. This makes it easy to see from the variable name that switchboard is a form, and similarly, if the variable type is a label, it should be named Lblswitchboard.


Prefix of lowercase letters commonly used in Hungarian nomenclature:
prefixType
A arrays (array)
b Boolean Value (Boolean)
by Byte (byte)
C signed character (Char)
CB unsigned character (Char Byte, not many people used)
CR Color reference value (COLORREF)
Cx,cy coordinate difference (length shortint)
DW Double Word
fn function
H Handle (handle)
I integral type
L Long int
LP Long Pointer
Members of the M_ class
n short integer (shorter int)
NP near Pointer
P Pointer
S-string
SZ null-terminated string type (string with Zero end)
W Word


Ii. Camel Nomenclature: (Camel method)
Camel-like command, as its name implies, is a mixture of uppercase and lowercase letters to form the names of variables and functions. For example:
printEmployeePaychecks ();//camel-type nomenclature [recommended]
Print_employee_paychecks ();//Underline method
The first function name uses camel-named notation-each logical breakpoint in the function name is marked with an uppercase letter;

The second function name uses the underscore method----each logical breakpoint in the function name is marked with an underscore.
Camel-style nomenclature has become more and more popular in recent years, and in many new libraries and environments like Microsoft Windows, it is well-suited to use. On the other hand, the underscore is popular after the advent of C, in many of the old Programs and UNIX environment, it is very common use.


Pascal (PASCAL) nomenclature:
Similar to the Camel name law. But the camel nomenclature is the first letter lowercase, and the Pascal nomenclature is capitalized
such as: public void DisplayInfo ();
String UserName;
Both use Pascal's nomenclature.

OK recommended Camel-style naming according to their preferences

"HTML" "11" Function name constraint specification

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.