Namespaces that correspond to file location

I would like to use “namespaces that correspond to file location” rule for my Unity project, but I cannot think about subdirectory names.

For example, I am having this script in this directory hierachy:

Scripts->Patterns->Singleton->Singleton.cs

So the namespace according to the rule above will be Scripts.Patterns.Singleton

But it intersects with a script class name and this is not ok for me. How I can name subdirectory for Singleton.cs?

You wouldnt have a namespace called Singleton you would put the Singleton class in the Patterns namespace. If you had multiple singleton implementations you could create a Singletons namespace instead.


I would argue that Patterns isnt a particularly good namespace either but its better than Singleton.