css| Specification | standardization
We have mentioned the problem of CSS naming many times in previous articles in webjx.com, and some friends still don't pay enough attention to these problems. This problem is irrelevant to CSS page layout development. Write your own style, you have the right idea. To modify a style you can quickly find the location of a style definition in a file based on your own memory or personal coding habits. Here is a description of the CSS naming article we introduced earlier:
But will your memory be as clear as if we were to revise the articles that we have written in a few months and years from now? If your personal habits are only a temporary rule, after a long time, perhaps to yourself, those strange names become difficult to understand.
Our project is sometimes not a person can be completed, need more collaboration, now the development model will be gradually improved, the division of labor is more and more fine, the team to develop more people collaboration will be the mainstream of future project development. Without uniform specifications and rules, our coding efficiency will be much lower. We must standardize our naming, let us more professional!
Today we introduce three kinds of naming rules on the basis of previous knowledge. These three naming conventions apply not only to the CSS and HTML encoding described above, but also to other types of programming 52css.com. They are: Camel nomenclature, Hungarian nomenclature, Pascal nomenclature. Below we give the introduction separately:
Camel-style nomenclature:
As its name implies, it refers to the combination of uppercase and lowercase letters to form the names of variables and functions. For example, the following is the same function named after the camel-style nomenclature and the Underline method:
Printemployeepaychecks ();
Print_employee_paychecks ();
The first function name uses camel-style nomenclature, and each logical breakpoint in the function name is marked with an uppercase letter; the second function name uses an underscore, and each logical breakpoint in the function name is marked with an underscore.
Camel-style nomenclature has become increasingly popular in recent years, and is used in many new libraries and environments such as Microsoft Windows. On the other hand, the underline method is popular after the advent of C, and in many old programs and UNIX environments, it is used very widely.
Hungarian nomenclature:
Widely used in environments such as Microsoft Windows. Naming conventions for variables (also including macros) used in Windows programming Hungarian nomenclature, which was proposed by Charles Simone, a competent Microsoft programmer.
The Hungarian nomenclature identifies the scope, type, and so on of the variable by prefixing the variable name with the corresponding lowercase letter symbol identifier. These symbols can be used at the same time, in order of first m_ (member variable), then pointer, then simple data type, and so on.
For example: M_lpszstr, represents a long pointer member variable that points to a string ending in 0 characters.
The key to Hungarian nomenclature is that the name of the identifier is prefixed with one or more lowercase letters, followed by a word or combination of words in the first letter, indicating the purpose of the variable.
Pascal (Pascal) nomenclature:
Similar to the Camel nomenclature. But the camel nomenclature is the first letter lowercase, and Pascal nomenclature is the first letter capital, such as:
DisplayInfo ();
String UserName;
Both of them adopt the Pascal nomenclature method. In C #, the name of Pascal and the Camel nomenclature are mostly used.
Three summary of naming conventions:
MyData is an example of Pascal's name.
And MyData is a camel nomenclature, it is the first word of the first letter lowercase, after the word first letter capitalization, looks like a camel
While Imydata is a Hungarian nomenclature, its lowercase i illustrates its form, followed by the same name as Pascal, indicating the purpose of the variable.