Rules of naming variables

DN_1C Skills Camp_Веб-баннер_850х150.png

This article describes the standards that apply to variable names. All of the listed recommendations are mandatory unless noted otherwise.

1. Name your variables based on the terms of the subject area, so that the variable name clearly describes its purpose.

2. Create variable names by deleting spaces that separate the words. Capitalize each word in the name, including prepositions and pronouns that consist of a single letter.

Example:

Variable DirectoryProcessingDialog; // Dialog to work with a directory
Variable PacksInBoxQuantity; // Number of packs in a box

Examples of incorrect variable names:

maxAttributes, matchTypeName, newStr

3. Do not begin variable names with an underscore.

4. Do not use variable names that consist of a single character. Short variable names are only allowed for loop counters.

5. Name variables that describe binary states ("true" or "false") after the state that matches the "true" value.

Example:

Variable HasErrors; // Shows whether procedure contains errors.
Variable IsReusableContainer; // Shows whether a product is a reusable container.
Next page: Writing register records


See also:

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.