views:

116

answers:

2

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

Is the Onion Architecture a subset of DDD?

+3  A: 

If you look at the image that describes the onion architecture in the link you provided, the Domain Model layer is what DDD focuses on.

Onion is an architectural pattern for a system, whereas DDD is a way to design a subset of the objects in the system. The two can exist without eachother, so neither is a subset of the other. If you were to use them together - then as a whole the part that is designed using DDD would be a subset of the entire system.

To use a (probably bad) analogy: Onion is a pattern to design a house, and DDD is a way to mill the wood that is a part of the house.

SnOrfus
+1  A: 

In my oppinion - they compliment 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).

Goblin