Variable naming
Variable naming is the practice of choosing clear, descriptive, and consistent identifiers that communicate the values or purposes they represent.
The Well-Grounded Python Developer: How the pros use Python and Flask
Meaningful naming is the practice of choosing identifiers whose words communicate the represented value, purpose, or operation.
- How it is used
- Improves readability and maintainability by attaching information about a value’s purpose or use to its identifier.
- How deep it goes
- Defines uniqueness and meaning, then demonstrates loop, employee, personal-name, and function-naming examples without exhaustive naming rules.
- Examples
- Uses opaque booleans, UUID identifiers, table loops, employee counts, personal names, and function names as naming comparisons.
- What you can do after
- Apply clearer names, refactor terse loop variables, and choose readable Python function identifiers.
Python How-To
Variable naming is the practice of choosing identifiers that clearly indicate the values or roles they represent.
- How it is used
- Improves readability and maintainability by making values, roles, and extracted data easier to understand.
- How deep it goes
- Explains naming through vague-name contrasts, calculated intermediates, and regular-expression groups, without prescribing a broader naming convention.
- Examples
- Uses total_score, subject_count, average_score, task_id, task_title, and task_desc as meaningful identifiers.
- What you can do after
- Apply it by replacing vague identifiers with names that reveal the represented data or computational role.
The Art of Code
Variable naming is the practice of choosing identifiers that accurately and consistently communicate the purpose of stored values.
- How it is used
- Shapes readable code by making stored values and their roles easy to understand.
- How deep it goes
- Explains naming patterns, scope, consistency, and cognitive load through a worked promotional-email example.
- Examples
- Uses promotional-email code, descriptive collection names, boolean naming, domain terms, and familiar loop-variable exceptions.
- What you can do after
- Apply naming and scope decisions that make intent visible and keep the main logic easy to follow.
Also covered in
- Simple Object-Oriented Design: Create clean, maintainable applications
- The Art of Unit Testing 3e
- Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
What to know first
- cognitive loadCognitive load is the mental effort required to process information or perform a task.
- inputAn input is information, a value, or an action supplied to a system, program, or computation for processing or to influence its behavior.
- variableA variable is a named program construct that associates an identifier with a value for reference and, where permitted, reassignment during computation.
- collectionA collection is a container or abstraction that groups multiple elements for storage, access, traversal, or processing.
Related concepts
- conventionuses · A convention is an accepted or customary practice for organizing, naming, or implementing things consistently within a group or context.
- code readabilityconfigures · Code readability is the ease with which human readers can understand source code and infer its structure, intent, or behavior.
- variableconfigures · A variable is a named program construct that associates an identifier with a value for reference and, where permitted, reassignment during computation.
Questions about variable naming
What is variable naming?
Variable naming is the practice of choosing clear, descriptive, and consistent identifiers that communicate the values or purposes they represent.
Which Manning books explain variable naming?
The Well-Grounded Python Developer: How the pros use Python and Flask, Python How-To and The Art of Code.
What should I know before learning variable naming?
Manning books that teach variable naming usually introduce cognitive load, input, variable and collection first.
What is the difference between variable naming and Hungarian notation?
Variable naming is the practice of choosing clear, descriptive, and consistent identifiers that communicate the values or purposes they represent. Hungarian notation is an identifier-naming convention that encodes type, purpose, or other conceptual information in a name, often through a prefix.
What is variable naming also called?
Variable naming is also called variable names.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


