Hungarian naming in programming

Source: Internet
Author: User

The Hungarian naming convention is a naming convention for programming. The basic principle is:

Variable name = property + Type + Object Description

Each object name must have a clear meaning. The full name or part of the object name can be used. The name must be based onEasy to remember and easy to understand. Guaranteed nameCoherenceVery important. The following are common naming rules for Hungary:

For example, if the form is named form, the Hungarian naming method can be abbreviated as frm. When the form variable name is switchboard, the full name of the variable should be frmswitchboard. In this way, it is easy to see from the variable name that switch is a form. Similarly, if the variable type is label, you should name it lblswitchboard.

You do not need to keep these naming rules in mind, but it is very useful to understand these rules.Good Programming habits are the first step to become a programmer.. It is necessary to use a standardized naming method and make it understandable to everyone. For example, we can see a gbflag variable, which can be easily understood as a global Boolean state variable.

You do not need to use Pinyin as the variable name. When programming, open an EnglishElectronic DictionaryFor example, youdao dictionary and Google translation, even if the words used are not appropriate, it does not matter. Pay attention to the singular and plural numbers. If a few words constitute a variable name, you can make the first letter of each word uppercase, for example, allbullets-all bullets.

What you can understand and guessAbbreviations. For example, bitmap can be abbreviated to BMP, source can be abbreviated to SRC, and so on.

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.