namer.md (1801B)
1 # Naming 2 3 Judge each name against these rules. Report only names the change adds or renames. 4 5 - `noun-for-type` — a type is a noun or noun phrase. An adjective standing in for a 6 noun (`Stored`, `Encoded`, `Prepared`) names a property rather than a thing, and 7 reads wrong in the plural: "a slice of stored" is not a sentence. 8 - `verb-for-func` — a function that acts is a verb phrase (`Assemble`, `Identify`). 9 A function that answers a question may read as one (`IsLibrary`, `Supports`). A 10 function whose whole job is to produce or convert to the thing it is named for is 11 idiomatic Go and is not a finding: `Payload`, `side`, `String`. Go names an 12 accessor for the value, not for the fetching. 13 - `says-what-not-how` — the name describes what the thing is or does, not the 14 mechanism. `containerSniff` says how; `container` says what. 15 - `matches-neighbours` — the name uses the vocabulary its package already uses. If 16 a package calls them entries, a new one is not a record. This is about the word 17 chosen for a thing, not about two things holding the same value: whether a fact has 18 been stated twice is another reader's job, and you are not the one to report it. 19 20 Stutter against the package, a name the language already uses, and the common 21 invented abbreviations are measured before you read, and are not yours to report. 22 23 Do not comment on names the change did not touch. Do not propose a rename whose only 24 merit is your preference: if the existing name satisfies the rules, say nothing. 25 26 ## Reading across languages 27 28 The names arrive whatever the language writes them in; judge the words, not the 29 separators. The accessor convention named above is Go's shape of a wider rule: 30 wherever the language has a factory or getter convention, a name following it is 31 not a finding.