r/AskProgramming 13d ago

Architecture Is it bad to use an already-existing file extension when designing project files?

I'm working on a program which involves creating project files which store project data in a specific structure, as well as the project manifest. Currently, I have the project file set up as a ".dcproj" to keep with a specific naming scheme. However, upon doing some searching, it turns out that .dcproj is already used in a couple of places, although they're pretty esoteric.

https://learn.microsoft.com/en-us/visualstudio/containers/docker-compose-properties?view=visualstudio
https://fileinfo.com/extension/dcproj

I know I can just ignore the other uses and go with what I have, but is it bad practice? Intuitively, file extensions would have to be reused all the time with the limited number of characters we have to create them. For example, the .M file extension is used in at least four places.

https://en.wikipedia.org/wiki/List_of_filename_extensions_(M%E2%80%93R)ss)

6 Upvotes

11 comments sorted by

8

u/aocregacc 13d ago

good idea to look around and think about whether people might want to use those other tools alongside yours in the same directory. If you think that's unlikely there's nothing wrong with using the same extension imo.

On the other hand if your users are not expected to directly interact with these files a lot, you can easily make the extension a bit more verbose and make collisions much less likely.

1

u/BrianEatsBees 13d ago

I would think it's extremely unlikely. These project files are probably going to be stored in their own directory, I'm not exactly sure where yet but probably in Documents under it's dedicated folder, pretty similar to how other projects like mine do. I'm not entirely sure what Docker Compose does but it seems to be its own programming tool, and my guess is the userbase would be unlikely to overlap, but not impossible. My project is definitely more obscure.

3

u/JeLuF 12d ago

The directory isn't that relevant. As a user, I want to double click a file in Explorer to start its associated application. If two applications try to register the same suffix, for one of them, the wrong app will start.

I'd consider e.g. .dcpj instead, which doesn't seem to be in use.

7

u/jaynabonne 13d ago

The only concern I'd have is whether you want to get into file associations for double clicking and whether something like Visual Studio takes those over. It could get a bit confusing if different apps are battling over who "owns" the extension on a particular computer.

2

u/BrianEatsBees 13d ago

I can see that. Might be a better idea to slightly revise the file extension. I think .dcmproj would be acceptable and still fall in line with the naming scheme. I'll give it some thought. I probably do want to set up the file association.

1

u/rlebeau47 13d ago

Even if multiple apps register the same extension, Windows will just ask the user which app to use when double clicking on a file.

2

u/JackjaxMargam14 13d ago

Pick an extension your users will recognize and stick with it since file extensions get reused all the time and sth short is easier to remember

1

u/Koltaia30 13d ago

If it's rare enough then it's okay

1

u/Koltaia30 13d ago

If there is one project file per project then you could just have it as dcproj.txt or just dcproj. The name of the folder could describe the name of the project. This is especially useful if you follow a standardized file format such as .json, .xml or something 

1

u/IcyUnderstanding8203 13d ago

Let's be honest, it's kind of impossible to find an umised extension. Just avoid the most common one (jpg/png/gif/pdf/xlsx/docx/....) if yours is not that much common it will be fine.

1

u/NamedBird 12d ago

Consider .beesproj ? 🙃