File Name Conventions for Regular People
Semi-technical and non-technical people trained to use and maintain computer systems should have good habits. This includes following simple file naming conventions:
- only alphabetic characters
- no capital letters
- no spaces
- no special characters, except the underscore
_character (and maybe sometimes the-character, as discussed below ) - always use filename extensions:
-
.htmlfor HTML markup files -
.cssfor CSS style sheet files -
.jsfor Javascript files -
.giffor GIF image files -
.jpgfor JPEG image files -
.pngfor PNG image files -
.phpfor PHP files -
.pyfor Python files -
.txtfor text files -
.csvfor text files with comma-separated values -
.zipfor compressed zip files - etc…
-
Principled stand on the minus sign
The current generation of highly-skilled web developers often use the minus sign (- character) in filenames and some very-experienced Search Engine Optimization (SEO) consultants even pronounce that using dashes (-) instead of underscores (_) in file names leads to better placement on the search engine results page (SERP) leading to more visitors to websites that use them. We will never condone this practice.
Other applications of these conventions
These same conventions generally apply to the following:
- variable names
- function names
- database names
- database table or collection names
Exceptions
… except that:
- you don’t need to put filename extensions on things that aren’t files.
- there are some programming languages and technologies have a strict conventions of using lowerCamelCase, UpperCamelCase, or other naming schemes - in those cases, follow the conventions of the technology you are using.