Hey Piotr, great stuff!
However, I would like to disagree with some points of your article and maybe start a discussion :)
- In my opinion what is presented as a
Domain Service is actually an Application Service. It is true that when you have logic corresponding to more than one aggregate you should have a Domain Service. But it only refers to domain logic. Using repositories, making external calls, and dispatching events are rather application logic where you orchestrate your business process (I have written about it here jorzel.hashnode.dev/different-types-of-applicatio… if you are interested, also recommend this nice article: enterprisecraftsmanship.com/posts/domain-vs-appli…).
- I think that your example of aggregate can be a little bit misleading. The purpose of the aggregate is to perform a change preserving consistency. However, in your example, there is no rule that is forcing you to put
add_order logic into Customer. What invariants relating to Customer are protected by this aggregate?