Crafting Variable Names for Maintainability
Crafting Variable Names for Maintainability
The ubiquity of variables in code makes variable naming an important skill for creating a durable and maintainable codebase. Few sources cover all the considerations that can go into variable naming in-depth. This training aims to act as a detailed handbook on this topic. It contains numerous tips that have been tested and refined over many years and supplemented with many concrete code examples. By mastering this material, you’ll be able to craft highly readable variable names that support a maintainable codebase.
- The Importance of Variable Naming
- Giving Names to the Unnamed
- Naming Accuracy
- Don't Use Unrelated Variable Names [VA1]
- Double-Check Variable Name Accuracy [VA2]
- Precisely Identify Boundary Conditions [VA3]
- Include the Primary "What" in the Variable Name [VA4]
- Distinguish Between Singular and Plural Data [VA5]
- Distinguish Between Different Kinds of "Fractional" Numbers [VA6]
- Fully Represent Multi-Part Values in Variables [VA7]
- Name At the Right Level of Abstraction [VA8]
- Problem Domain Naming
- Name Length & Specificity
- Avoid Overly Short Names [VS1]
- Avoid Overly Generic Names [VS2]
- Avoid Overly Long Names [VS3]
- Minimize Repeating Class Names in Member Variable Names [VS4]
- Make Names Specific Enough to Distinguish Between Similar Concepts [VS5]
- Make Names Specific Enough to Distinguish Between Similar Variables [VS6]
- Name "Functional" Variables with Enough Specificity to Make Operations Clear [VS7]
- Communicate Intent in Names Where Appropriate [VS8]
- Acronyms & Abbreviations
- Word Ordering
- Word Choice [VC1]
- Units/Data Formats in Names
- Naming Specific Kinds of Data
- Loop Indices/Iterators
- Temporary/Intermediate Data [VD4]
- Constants [VD5]
- Booleans
- Collections
- Filesystem-Related Variables
- Distinguish Between Different Levels of Filesystem Abstractions [VD13]
- Distinguish Between “Names” and “Paths” Where Applicable [VD14]
- Distinguish Between Different Kinds of Paths Where Applicable [VD15]
- Distinguish Between Files and Folders/Directories [VD16]
- Allow Interchanging "Folder" and "Directory" [VD17]
- Date/Time-Related Variables
- Naming Conventions
, multiple selections available,
Related content
The Importance of Variable Naming
The Importance of Variable Naming
More like this
Make Names Specific Enough to Distinguish Between Similar Variables [VS6]
Make Names Specific Enough to Distinguish Between Similar Variables [VS6]
More like this
Giving Literal Values Names
Giving Literal Values Names
More like this
Crafting Documentation for Maintainability
Crafting Documentation for Maintainability
Read with this
Code Maintainability: Best Practices
Code Maintainability: Best Practices
More like this
Code Maintainability Best Practices
Code Maintainability Best Practices
More like this