Is this a good file name? What do you think this file is?
A PDF? Sure, you’re right. Anything else? Hmmm … the numbers could be a date? Right again, nice work. More? A document? A bit vague, but there’s not much else to go on is there.
What about this one?
Another PDF, obviously, and by the look of it, created a few minutes after the other one. Could it be a newer version of the other document? Maybe?
Actually these are real files from a real commercial system that handles the billing for a power company in Australia. You know, the sort of place that has a bunch of usability issues with their site but won’t or can’t do anything about it. Those of you who know who I am talking about will know doubt have performed a little better than average on the little quiz above having wrestled with those files before, as I have.
Let me tell you about these files and why they stink.
The files contain an account for one billing period. Ah, I hear you say, that’s what the date is for. Uh, no. The file’s name is nothing more than a time stamp for the moment that the file was created. Not the billing period start date, not the date you paid it, not the date the meter reading was taken, not anything even remotely useful. The second file, above, is actually the same file! Exactly the same content.
The file names coming from this system are worse than useless – they actually cause confusion and error.
- Unless you actually performed the download yourself, you can’t guess what is in the file.
- Even if you do know, you have to open the file to see which billing period it is.
- Unless you strictly download the separate files in order, they will list out of bill-order in a directory listing.
- The name format affords no memorable feature. In a large list of these files it’s difficult to remember which ones you have already processed.
Let’s see if we can improve it; what about:
I’m not saying that this is optimal, but if I am in the habit of downloading my electricity bill statements I can easily see who it’s from, which account, and when, in date order, without having to open the files. Also, if I have “processed” the file in some way I am more likely to be able to remember that.
Putting the date first is also ok. I mean anything would be better than what I actually get now. The only good thing about the current file names is that it would be good during system testing because they are nicely timestamped so I can compare that with the build time for the code and determine which code produced which file. Unfortunately, I am not a tester of their system, but a customer who just wants to organise his paperwork.
If you are writing an application that produces files or allows a visitor to download files from your site consider how that person is most likely going to use that file.
- Dates should relate to the content. Generation date-time? I don’t think so.
- Do you need to really put minutes and seconds in?
- Consider lexical ordering. Remember numbers will come first.
- Zero pad sequence numbers so that order is maintained.
- Use descriptive text not generic terms like doc, file, etc.
- Don’t be frightened of longer file names. A useful long file name is way better than a short useless one.
Choosing a file naming scheme for the most part is one of the easiest parts of developing a system and yet very little attention seems to be given to that task. Take just a few minutes to consider the needs of people who are using these files and what they may be doing with them to make a better decision on the file names to use.