Naming Conventions in Software Engineering: Lessons from Ancient Chinese Naming Traditions
This article explores how the three pillars of traditional Chinese name selection—traceable origins, phonetic and visual harmony, and semantic consistency—map directly to software engineering naming practices. Learn how to build a naming framework for domain models, APIs, variables, and configurations, and how to enforce these rules through CI checks and cloud resource management to improve code maintainability and searchability.
1. Starting with “Yang”: The Three-Layer Structure Behind a Name
Traditional Chinese naming always required a traceable literary source. Take the character “旸” (yáng) as an example. Its meaning relates to the valley where the sun rises, originating from ancient texts describing the sun deity. Historically, “启明” (qǐmíng, meaning “morning star”) was used as a complementary courtesy name—one representing darkness and the other light, creating a complete conceptual loop. Setting aside the literary flair, this name is considered “stunning” not because of ornate vocabulary, but because it satisfies three conditions simultaneously:
- Clear origin: Every character can be traced to a reliable source.
- Phonetic and visual harmony: It is easy to read and write, visually balanced, and unambiguous.
- Semantic self-consistency: The given name and the courtesy name explain each other, forming a coherent system.
This three-layer structure is highly analogous to the “naming” problem in engineering. Code, interfaces, configurations, and documentation are all essentially “names” meant to be read by humans, and all require origin, form, and meaning.
2. The Three-Layer Naming Framework: Origin, Form, and Meaning
2.1 Origin: Names Must Have a Traceable Source
Ancient scholars cited classics to give names a solid foundation. Engineering naming works the same way: a variable, an interface, or a field should be traceable to a domain glossary, data dictionary, or design document. Traceability yields two direct benefits: lower onboarding costs for new team members and fewer cross-team communication ambiguities.
Best practices:
- Build a glossary that standardizes the mapping between Chinese and English domain terms.
- Ensure interface and field names correspond one-to-one with the data dictionary.
- Update documentation whenever names change to avoid “names that exist in name only.”
2.2 Form: Readable, Spellable, and Searchable
The character “旸” is not so obscure that it cannot be written, nor so common that it loses distinctiveness. “Form” in engineering naming maps to three points: moderate length, unique spelling, and searchability.
Bad examples: a, tmp, data2, flag1Good examples: retryBudget, traceId, schemaVersion
Search-friendliness is especially critical. If a name can be uniquely located via a global search, the maintainability of the codebase improves significantly. Conversely, a generic name like data might be scattered across hundreds of locations, causing refactoring costs to skyrocket.
2.3 Meaning: Name and Reality Explain Each Other
Just as “启明” complements “旸”, engineering naming requires systemic consistency: the same concept must share the same root across different layers, and different concepts must never share the same word.
- Same concept:
userId,userProfile, anduserSettingsshare theuserroot. - Different concepts: Distinguish between
idanduuid,countandtotal,startAtandcreatedAt.
3. Mapping to Engineering Practices: Naming Rules for Four Object Types
3.1 Domain Models and Classes
Center names on business nouns and avoid a proliferation of technical suffixes. A model name should answer “what this is,” not “how it is stored.”
// Recommendedpublic final class SettlementBatch { }// Not recommendedpublic final class SettlementBatchDataManagerHelper { }
3.2 Interfaces and Routes
Interface names should reflect resources and actions, maintaining a clear division between verbs and nouns. Separating queries from commands facilitates permissions and auditing.
GET /orders/{id} // QueryPOST /orders/{id}/cancel // Command
3.3 Variables and Functions
Variables express “what it is”; functions express “what it does.” Use is/has/can prefixes for booleans and plurals for collections to avoid abbreviation ambiguity.
isRetryable, hasExpired, pendingTasks, maxRetryTimes
3.4 Configurations and Documentation
Configuration items need namespaces, and documentation titles must remain consistent with code symbols, closing the loop of “origin, form, and meaning.”
4. Actionable Workflow and Validation
- Define terminology before coding: Establish the glossary first and move naming reviews to the pre-development stage.
- Static checks: Integrate naming rule validation into CI to flag abbreviations, single letters, and redundant suffixes.
- Review checklist: Is it traceable? Is it uniquely searchable? Is it consistent with existing roots?
- Change management: Treat renaming as refactoring, requiring synchronized updates to documentation and callers.
Example validation rules:
naming:forbidSingleLetter: truerequireBooleanPrefix: [is, has, can]maxIdentifierLength: 32
5. Naming Consistency in Cloud Collaboration
When a system spans multiple general cloud capabilities (object storage, message queues, container platforms, logging services, and monitoring alerts), naming consistency dictates troubleshooting efficiency. It is recommended to standardize resource prefixes, environment identifiers, and region identifiers so that logs, metrics, and traces can be aligned directly by name. General practices on cloud platforms like Baidu AI Cloud also emphasize standardized resource naming to reduce cross-service location costs.
6. Conclusion
The brilliance of traditional Chinese naming comes from the unity of origin, form, and meaning. Migrating this aesthetic to engineering naming makes codebases more searchable, auditable, and evolvable. Naming is not a matter of stylistic preference; it is the cheapest, highest-leverage investment in maintainability.
