Should the folders in a solution match the namespace?
In one of my teams projects, we have a class library that has many sub-folders in the project.
Project Name and Namespace: MyCompany.Project.Section
.
Within this project, there are several folders that match the namespace section:
- Folder
Vehicles
has classes in theMyCompany.Project.Section.Vehicles
namespace - Folder
Clothing
has classes in theMyCompany.Project.Section.Clothing
namespace - etc.
Inside this same project, is another rogue folder
- Folder
BusinessObjects
has classes in theMyCompany.Project.Section
namespace
There are a few cases like this where folders are made for "organizational convenience".
My question is: What's the standard? In class libraries do the folders usually match the namespace structure or is it a mixed bag?
Best Solution
Also, note that if you use the built-in templates to add classes to a folder, it will by default be put in a namespace that reflects the folder hierarchy.
The classes will be easier to find and that alone should be reasons good enough.
The rules we follow are: