About a week ago I posted a message to the Yahoo DDD group to see how other people were organizing their namespaces in their Domain Model. For the most part everyone had the same basic idea. You can read the message here.
In the domain layer, the general consensus seems to be to organize your namespaces around aggregates and/or entities. Not around lower level ideas like “interfaces”, or “services”. You can do this once you break it out into entities, but the first layer or organization should not be around low level organization. Here is an example of how I would setup namespaces in a Blog engine project. After some refining and trying a couple of different ideas I find that this works best for me.
BlogEngine.Core (root namespace for domain model)
- Comment BlogEngine.Core.Blog.Exceptions
And so on. This gives you a nice clear view of your dependencies between aggregates. In each of the User/UserDetails classes, you can clearly see what other aggregates it depends on. I would go even further to say I would seperate interfaces within the aggregate. But this is a task for another day. I would be very interested to hear everyones comments on this. I think everyone uses the same basic ideas but perhaps someone has a better way of doing this that would help enlighten the rest of us =)