Changes for page Expressive Names

Last modified by chrisby on 2023/11/18 17:45

From version 1.2
edited by chrisby
on 2023/11/17 21:53
Change comment: There is no comment for this version
To version 1.4
edited by chrisby
on 2023/11/17 22:01
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,45 +1,27 @@
1 -1.
2 -
3 -**Meaningful and Descriptive Names**
1 +* **Meaningful and Descriptive Names**
4 4   * Choose names carefully, as if naming a child.
5 - * Names should reflect the code's purpose clearly. For example, use unorderedNumbers and orderedNumbers instead of a generic numbers.
6 -1.
7 -
8 -**Avoid Misinformation**
3 + * Names should reflect the code's purpose clearly. For example, use `unorderedNumbers` and `orderedNumbers` instead of a generic `numbers`.
4 +* **Avoid Misinformation**
9 9   * Steer clear of ambiguous, easily confused names or characters (e.g., l vs. 1, O vs. 0).
10 -1.
11 -
12 -**Clarity in Differences**
6 +* **Clarity in Differences**
13 13   * Distinguish names distinctly, avoiding similar expressions and redundant words (e.g., a, an, the, info, data).
14 -1.
15 -
16 -**Pronounceable and Searchable Names**
8 +* **Pronounceable and Searchable Names**
17 17   * Use names that are easy to pronounce and discuss.
18 18   * Name length should match its scope: short for local loops, longer for broader usage.
19 -1.
20 -
21 -**No Encodings or Mental Mappings**
11 +* **No Encodings or Mental Mappings**
22 22   * Avoid including type or scope information in names.
23 - * Names should be clear without requiring mental translation.
24 -1.
25 -
26 -**Naming Conventions for Classes and Methods**
13 + * Names should be clear without requiring mental translation, meaning any effort of the programmer to get the actual purpose
14 +* **Naming Conventions for Classes and Methods**
27 27   * Class names: Use nouns or noun phrases.
28 28   * Method names: Use verbs or verb phrases, adhering to standards like JavaBean (get, set, is, has). Utilize descriptive function names instead of overloaded constructors.
29 -1.
30 -
31 -**Avoid Inappropriate Humor and Ambiguities**
17 +* **Avoid Inappropriate Humor and Ambiguities**
32 32   * Refrain from humorous names.
33 33   * Choose one word per concept to maintain consistency (e.g., always use "get" instead of alternating with "fetch" or "retrieve").
34 34   * Avoid puns and ambiguous terms (like "add" for addition or appending).
35 -1.
36 -
37 -**Domain-Specific Naming**
21 +* **Domain-Specific Naming**
38 38   * Use technical terms (solution domain) for clarity among programmers.
39 39   * Use terms from the problem domain when no technical equivalents exist, aiding domain experts.
40 -1.
41 -
42 -**Context and Simplicity in Naming**
24 +* **Context and Simplicity in Naming**
43 43   * Provide meaningful context through combined variable and method names.
44 44   * Avoid unnecessary context; opt for shorter, meaningful names.
45 45   * Be open to renaming for clarity and improvement.