3

This is related to DDD for a desktop application in c#...with 4 layers ui/application/domain/infrastructure. Actually 3 desktop applications sharing part of the domain and part of the infrastructure.

In an effort to avoid developers crossing the wrong layers and using the wrong classes, I separated the layer in assemblies and set the reference/dependencies in accordance. If the infrastructure is a dll/assembly and the domain another dll/assembly and the application is an exe/assembly and the ui is a dll/assembly... then the project cannot the build. Who's gonna load the the ui.dll? Am I missing something here?

The only solution i have come with is creating a fifth layer called Program. That layer will have the entry point of the program and will wire everything together (I'm using DI with Unity )

Any idea?

1 Answer 1

2

The Program solution seems fine to me. Thats usually how it really is. And if you are worried about developers putting stuff in wrong assemblies, you should either apply some kind of code review process. Or if you want to go into extreme, separate them by "project". Eg. Domain could be it's own separate project with separate feature and bug tracking, planning, release, etc.. That is only way to actually force complete separation of the domain.

3
  • That's how I have them now in separated projects. I have read the original DDD book like 4.5 times already, and I always found that piece missing that will glue the ui with the application layer.
    – user143323
    Jul 20, 2014 at 12:58
  • @user143323 That is because DDD is not about application architecture. Its about expressing business rules in code.
    – Euphoric
    Jul 20, 2014 at 17:42
  • FWIW Visual Studio 2012 (I think ultimate, may be in lower version?) has the ability to apply governance to which layers access others.
    – FastAl
    Jul 22, 2014 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.