D
D
Dmitry2014-07-15 08:53:33
C++ / C#
Dmitry, 2014-07-15 08:53:33

What is your attitude to prefixes in source file names?

I use very often a naming scheme for file and class names. Before the main name explaining the purpose of the class, I also indicate a prefix showing the connection with one or another part of the code. For example, if there is a class ElfImage and a namespace elf, then the file names are eflimage.hpp/elfimage.cpp.
And now I'm thinking: Am I duplicating information? After all, the namespace elf clearly indicates that Image refers to it.
After some thought, I came to the conclusion that the Alt + Shift + 'O' hot button in my MSVS with the Visual Assist X plugin is to blame. This button provides convenient navigation through file names.
The essence of the question: Am I really duplicating or not? And please justify your opinion

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Misha Krinkin, 2014-07-15
@kmu1990

You're duplicating information, but no one will see the namespace until they look at the code, so that's not necessarily a bad thing. IMHO, for a project of several files, this is not particularly necessary, but for a project with a bunch of files, I prefer to sort it into folders - a natural prefix is ​​obtained.

T
Trrrrr, 2014-07-15
@Trrrrr

As for me, it was just the namespaces that came up with the need to do so.
But often you have to create some kind of non-standard versions of standard classes (for example, they are a vector in Africa and a vector in a boost :)), and even despite the namespace, they add a prefix, for example, the name of the project.
And also, you should not add using Hungarian notation, a modern IDE will ruin everything anyway.
BUT most importantly, no matter what you do, no matter how you write, use a single style throughout your code.
If you decide to write like this, then write like that everywhere. Because a hodgepodge of all styles is the biggest crime.

A
AxisPod, 2014-07-17
@AxisPod

I don’t do prefixes and I won’t, but I put everything neatly into folders. I never keep everything in one, it turns out a terrible mess. Especially when there are 300 or more files.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question