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:

    1. Clear origin: Every character can be traced to a reliable source.
    2. Phonetic and visual harmony: It is easy to read and write, visually balanced, and unambiguous.
    3. 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.

    1. Bad examples: a, tmp, data2, flag1
    2. Good 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, and userSettings share the user root.
    • Different concepts: Distinguish between id and uuid, count and total, startAt and createdAt.

    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.”

    1. // Recommended
    2. public final class SettlementBatch { }
    3. // Not recommended
    4. public 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.

    1. GET /orders/{id} // Query
    2. POST /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.

    1. 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

    1. Define terminology before coding: Establish the glossary first and move naming reviews to the pre-development stage.
    2. Static checks: Integrate naming rule validation into CI to flag abbreviations, single letters, and redundant suffixes.
    3. Review checklist: Is it traceable? Is it uniquely searchable? Is it consistent with existing roots?
    4. Change management: Treat renaming as refactoring, requiring synchronized updates to documentation and callers.

    Example validation rules:

    1. naming:
    2. forbidSingleLetter: true
    3. requireBooleanPrefix: [is, has, can]
    4. 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.