Search code examples
c#javaarchitecturedomain-driven-designonion-architecture

What is the relationship between DDD and the “Onion Architecture”?


What is the relationship between Domain-driven design (DDD) and "The Onion Architecture" of Jeffrey Palermo?


Solution

  • In my opinion - they complement each other - but from very different perspectives.

    Onion Architecture is all about making the Domain/BusinessLogic independant on 'inferior' things like data-acccess, UI, services etc. The Onion Architecture doesn't really care how you made the domain you have - it's adamant about protecting it from outside dependencies.

    Domain Driven Design is all about how you model your Domain and what you call your objects. Meaning that each Domain class should have a direct relation to what it represents in the business domain it is adressing (ie. the physical/real world). So a Customer object should be named a Customer in code - it should have the same rules as a Customer does in the real world (or as close as it is possible).