Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choosing a suitable file extension for an application

I'm working on an application that runs on both Windows and Mac. The application allows users to save their work to a file and later load it back into the application - much like Word, Excel etc.

What issues should I consider when choosing an appropriate file extension for the file?

So far I'm using http://filext.com/ to make sure I don't choose an extension already in use.

like image 654
CodeBuddy Avatar asked May 26 '11 05:05

CodeBuddy


1 Answers

The 3-character limit doesn't exist anymore on Windows, so I would suggest to use a longer extension that makes it immediately clear that this is for your application. E.g. suppose that your application is called StreetBuilder, just use the extension .streetbuilder.

Beware of version-related issues. After a few years you might want to change your file format because of new functionality in your application. Don't be tempted to change the file format and the file extensions (because you then end up with extensions like .streetbuilder2, .streetbuilder3, ...). Instead, stick to a consistent extension (.streetbuilder), and include a version number in the beginning of the file contents.

What I typically do is to start the file with contents like this (still assuming that your application is called StreetBuilder): "STREETBUILDERV01" or maybe a cryptic string followed by a version number.

If you now want to change your file format, you just increase the version number. That way your application can always check whether the file is really for your application, and you also know how to parse the file (depending on the version number).

like image 178
Patrick Avatar answered Nov 15 '22 06:11

Patrick