Summary of naming conventions for C + +, Java, and C #

Source: Internet
Author: User
Tags lowercase

Preface

Because of the frequent use of C + +, Java, and C # as a development language in development work, the problem of naming conventions often causes me some trouble. On the one hand, there is no single standard answer to the naming code, on the other hand, although the naming of the language is not a fixed form, the style of three languages is not the same, but also each has some unique characteristics. In the process of writing code, the naming method is often changed, and no fixed style is formed. Therefore, according to some data collected from the Internet and some of its own experience, the C + +, Java and C # Naming conventions are summarized to facilitate future inquiries.

Principles of Naming conventions:

L try to adopt the naming rules used before;

L try to use the same naming rules in three languages to facilitate memory;

L try to adopt naming rules from the official (e.g. Sun, MS).

1. Hungarian nomenclature, Camel Nomenclature and Pascal nomenclature

Hungarian nomenclature: Used in Windows programming is very common, proposed by one of Microsoft's Hungarian programmers. The Hungarian nomenclature identifies the scope, type, and so on of the variable by prefixing it with the corresponding lowercase symbol identifier in front of the variable name. For example, M_LPSZSTR represents a long pointer member variable that points to a string ending in 0 characters. Hungarian nomenclature is very awkward to use in object-oriented program design.

Camel nomenclature: Camel-style nomenclature because the name is used to look like Camel hump. There are two forms of camel naming: Mixing uppercase and lowercase letters and underlining between words, such as Runfast and Run_fast, belong to the Camel nomenclature.

Pascal nomenclature: Similar to the Camel nomenclature, but the first letter of Pascal's nomenclature is capital letters.

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.