问题
Sometimes I have need to call namespace and class the same. For example, SomeProject.Compiler namespace, containing lots of compiler-related stuff and the main entry point class Compiler. But naming namespace and class name the same is not recommended, as it creates ambiguity and misleads compiler.
Is there any idea, how to name them better?
回答1:
It is always possible to give general namespace name, which describes all its members. For example, CompilerServices instead of compiler.
回答2:
Some books say you should write the domain of your company (in the reverse order) before the name of namespace.
Something like com.company.www.compiler
来源:https://stackoverflow.com/questions/4547254/how-to-avoid-class-name-and-namespace-conflict