Changes for page Expressive Names

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

From version 2.4
edited by chrisby
on 2023/11/18 17:43
Change comment: There is no comment for this version
To version 2.6
edited by chrisby
on 2023/11/18 17:45
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -16,6 +16,7 @@
16 16  * **Use pronounceable names.** Programming is a social activity that people talk about with others, so use names that are easy to use in conversation.
17 17  * **Use searchable names.** Searchable means avoiding search conflicts with other independent things with the same name. The length of a name should match the size of its scope. For local counting loops, one letter is sufficient; if the variable is used in multiple places in the code, it needs a longer name.
18 18  * **Dare to rename things.** Your colleagues should be grateful for improvements.
19 +* **Add meaningful context.** By including the names of other variables and methods, this context can be created to make its purpose clearer than without context. Names can be chosen to work well with others.
19 19  
20 20  #### Don'ts
21 21  
... ... @@ -24,6 +24,6 @@
24 24  * **Avoid mental mappings.** The name of a variable should not require mental effort to understand. For example, unusual abbreviations should be avoided.
25 25  * **No puns or humorous names.**
26 26  * **Avoid ambiguities** such as the word "add", which could have the meaning of "addition" or " adding".
27 -* **Make differences clear** by avoiding very similar expressions and redundant empty words (a, an, the, info, data).
28 -* **Add meaningful context.** By including the names of other variables and methods, this context can be created to make its purpose clearer than without context. Names can be chosen to work well with others.
28 +* **Avoid very similar expressions** to make differences clear.
29 +* **Avoid redundant empty words** (a, an, the, info, data).
29 29  * **Do not add unnecessary context.** Shorter names are better than longer ones, as long as they are clear.