Distinguish Between “Names” and “Paths” Where Applicable [VD14]
Distinguish Between “Names” and “Paths” Where Applicable [VD14]
Tip VD14
Programmers often need to know if a string they’re given is just the “name” of a file within a folder/directory or a longer path. A “path” can often be used “as-is,” but with just a filename, it often has to be looked-up to get a longer path. Use name
and path
suffixes to help differentiate between the different kinds of data.
A filename is a subset of a filepath, so if both are acceptable for a variable, you can use a path
suffix and document the considerations.
The following examples of function signatures demonstrate the distinctions:
, multiple selections available,
Related content
Distinguish Between Different Kinds of Paths Where Applicable [VD15]
Distinguish Between Different Kinds of Paths Where Applicable [VD15]
More like this
Document Specifics of Filesystem Paths [DI34]
Document Specifics of Filesystem Paths [DI34]
More like this
Distinguish Between Files and Folders/Directories [VD16]
Distinguish Between Files and Folders/Directories [VD16]
More like this
Distinguish Between Different Levels of Filesystem Abstractions [VD13]
Distinguish Between Different Levels of Filesystem Abstractions [VD13]
More like this
Name Length & Specificity
Name Length & Specificity
More like this
Name At the Right Level of Abstraction [VA8]
Name At the Right Level of Abstraction [VA8]
More like this