Filesystem-Related Variables

Filesystem-Related Variables

Filesystems are a common storage feature of computing, and as such, many programs will need to interact with them - they’re typically inescapable. There are numerous terms that exist in the filesystem realm - file, folder, directory, path, etc. Because these entities cannot all be interacted with in the same way and they often appear in the same context of code, it’s worth learning the appropriate problem domain terminology and being precise in how you name variables referring to these entities.

Before we go further, a word on stylistic conventions in filesystem-related naming: “spacing” of words in filesystem names (“filesystem” vs. “file system”, “filepath” vs. “file path”, etc.) can be hotly debated. This training uses some conventions (typically favoring single words), but there are trade-offs involved in each choice. The exact convention used isn’t the most important. If inconsistency is becoming a problem in you codebase, pick a convention and stick with it.

The following guidance helps with naming filesystem-related variables:

 

Say goodbye to blindsided code updates ad.png