Skip to content
← Back to glossary

命名規則Naming Conventions

Learn in the textbookCoding Conventions and Structuring

DefinitionNaming conventions (命名規則) are rules agreed in advance on how to name variables, functions and other elements.

ExplanationTypical rules are to use English words that show the role, to mark word breaks with capitals or underscores, and to write constants in all capitals. Naming conventions are usually set together with rules such as the indentation width, as part of the coding standards that keep the way programs are written consistent. When names follow one scheme, people other than the author can guess a name's role from the name alone.

AnalogyIt is like naming every file in a cabinet as "year-month_client_content", so anyone looking can guess what is inside.

Related past-exam questions(1 question)