Namespaces, Folders, and Redundancy, Oh My! Folder structures untangled?
Yeah, I've looked around at some of the existing posts Grouping of project files into folders/namespaces
Namespaces and folder structures in c# solutions: how should folders on disk be organised?
And the like. I'm running into a situation.. sort of, where I'm unsure if I am over开发者_JAVA技巧 complicating my program.
I have three projects, organized much like this ...
Web
- Areas
- Controllers
- Container
- Modules
- Content
- css
- scripts
- images
- Views
Models
- [Namespace.a] // example, Project.Membership
- Messages [Interfaces for Queries]
- Models
- domain-model.cs
- domain-model.cs
- domain-model.cs
- Extensions
- domain-model-extensions.cs
- domain-model-extensions.cs
- Errors
- domain-model-error-messages.cs
- domain-model-error-messages.cs
- Factories
- domain-model-factory.cs
- domain-model-factory.cs
- [Namespace.b] // example, Project.Books
- Messages [Interfaces for Queries]
- Models
- domain-model.cs
- domain-model.cs
- domain-model.cs
- Extensions
- domain-model-extensions.cs
- domain-model-extensions.cs
- Errors
- domain-model-error-messages.cs
- domain-model-error-messages.cs
- Factories
- domain-model-factory.cs
- domain-model-factory.cs
- [Namespace.c] // example, Project.Tags
- Messages [Interfaces for Queries]
- Models
- domain-model.cs
- domain-model.cs
- domain-model.cs
- Extensions
- domain-model-extensions.cs
- domain-model-extensions.cs
- Errors
- domain-model-error-messages.cs
- domain-model-error-messages.cs
- Factories
- domain-model-factory.cs
- domain-model-factory.cs
- [Namespace.d] // Example, Project.Blogs
- Messages [Interfaces for Queries]
- Models
- domain-model.cs
- domain-model.cs
- domain-model.cs
- Extensions
- domain-model-extensions.cs
- domain-model-extensions.cs
- Errors
- domain-model-error-messages.cs
- domain-model-error-messages.cs
- Factories
- domain-model-factory.cs
- domain-model-factory.cs
- [Namespace.a] // example, Project.Membership
And you get the idea... basically this structure works fine for me. My question is whether anyone else organizes like this, or if I'm just making my solution load slower with this much micro-foldering. My thought process is basically ..
each namespace is like a folder, so give it a folder. each object is like a file, so give it a folder. each thing relating to an object is like a property, so organize them.
This may sound like a really stupid question in general. I'm very OCD about management and organization, but I'm wondering if keeping everything so ...what is the word... modular? is the wisest decision in this case. Currently I have 28 namespaces in one of my projects, each with anywhere between 3 to 8 objects in it.
That looks pretty sensible to me. Maintaining a well laid out logical folder/namespace hierarchy is good practice.
Additionally, the use of tools like Resharper make it very easy to quickly navigate to files/types even when you do have a fairly deep folder structure.
精彩评论