liveBook · Manning

Specialized terminology

As explained in The Art of Code

Domain-specific vocabulary is the terminology established by a problem domain for naming its entities and concepts.

Specialized terminology gives code a consistent vocabulary for the domain it represents. When the same entity is called a client in one place and a visitor in another, readers must translate unnecessarily; consistent names reduce cognitive load and make intent easier to understand. section 2.4

Use domain terminology deliberately when naming:

  • Nouns for data, usually singular except for collections. section 2.4
  • Question-like names for booleans, such as isUserEligible. section 2.4
  • Verb-like names for lambdas that represent actions. section 2.4
  • Clear domain names instead of ambiguous identifiers such as x, temp, flag, or data. section 2.4

From generic data to domain intent

A list named users communicates its contents, while selectedUsersForExclusiveGift communicates its purpose and discourages accidental additions or removals. Likewise, a promotional-email method becomes clearer when it consistently uses User, Promotion, birthdayPromotions, and standardPromotions rather than generic temporary names. section 2.4

How The Art of Code covers it

How deep it goes
Defines naming conventions and demonstrates them through variable examples, while stopping short of a broader domain-modeling treatment.
Examples
Uses users, selectedUsersForExclusiveGift, isUserEligible, client versus visitor, and promotional-email variables as naming examples.
What it assumes
Assumes basic familiarity with variables, collections, booleans, lambdas, and loop variables.
What you can do after
Apply it via consistent, descriptive identifiers that distinguish data, collections, booleans, and actions.
How it connects
Connects domain-specific vocabulary with variable naming, readability, intent, consistency, and cognitive load.

Also explained in

Compare how 2 books explain specialized terminology →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.