If you work with files you should have a set of rules that you follow so that your file names are always consistent. This is especially true if other people will be working with your files which is very common in web work and programming.
Here’s the file naming conventions that I have developed over the years as a programmer and web person. What you do is not as important as being consistent. Using the same name convention will save you countless hours of “fixing” things and looking up to see how a filename was spelled. I recommend using these rules for filenames, folders and directories, and variable names.
- always start a filename using lowercase
- don’t use spaces or underscores _
- use camelCaseToMakeNamesEasierToRead
- don’t use plurals – for example: Use “graphic” instead of “graphics”
- be consistent with extensions. .html should always be .html and not .htm one day or .default on another day.
Here’s the reasoning and experience that helped me develop this list:
Always start a filename using lowercase
80% of the web servers use Apache running on Linux and Linux is case sensitive. By starting every name with a lower case letter you remove the guesswork like “Now, was it Index.html or index.html?” On a Linux server these are two different things.
Each time you have to go look up a file name to find out you used the wrong upper/lower case means less time with your video games or bronzing on the beach.
Don’t use spaces or underscores “_”
Web servers and programming languages are befuddled by spaces. They may work in Windows and Word, but most other computer programs don’t even allow them. Linux is a good example.
Why not underscores “_” you may ask. Underscores will “hide” when being displayed as an underlined word and users think they are spaces. Also, why add another character to your name if you don’t have to? And finally, how many people can touch-type the _ character. Every time you have to pause your typing to hit a special key means the longer it takes to complete your killer app.
This is the solution to not using spaces or underscores. Note how easy it is to read the statement above. Its much faster to type this way. You’ll have to personally decide how you are going to handle acronyms. For example: web3RSS.html or web3Rss.html or web3rss.html
My recommendation, for readability and recognition, is to keep an acronym as all caps: web3RSS.html
Don’t use plurals
For example: use “photo” instead of “photos”
When working with a programming team we spent countless hours fixing our programs because of simple spelling “errors” like this. Then, one day someone suggested that we follow this rule and everyone’s life got so much easier.
It’s a little weird at first, but after a few times of knowing how a foldername will be and not having to go look it up makes it all feel right in the end.
Be consistent with extensions and keep them lowercase.
I recommend always using .html. Don’t use .htm one day and .html the next.
Same thing with .jpg
By following these rules on a regular, and consistent basis, you will be able to work faster and with a lot less frustration.Note:
There’s a few exceptions to all of this. If you are a Java or .NET programmer than you will want to have all your Class files begin with an upper case letter. And constants are always written using ALL_CAPS with underscores to separate the words. These are both naming conventions that were around a lot longer than my little set of rules.