Domain model should be dependency-less. Therefore - it must not contain any reference to logging mechanism. I understand that there are not any problems with logging infrastructure&application layer, but what if i want to log domain model? Is it not supposed to be logged, just unit tested & logged from outside (infrastructure/application)?
A Domain Event is an event that is spawned from this model that is a result of a decision within the domain. Within the model our Aggregates have the role of maintaining business rules and this is where we implement decision points in our model, so the Aggregates are also responsible for creating the Domain Events.
Domain-Driven Design(DDD) is a collection of principles and patterns that help developers craft elegant object systems. Properly applied it can lead to software abstractions called domain models. These models encapsulate complex business logic, closing the gap between business reality and code.
Domain-Driven Design is a concept introduced by a programmer Eric Evans in 2004 in his book Domain-Driven Design: Tackling Complexity in Heart of Software. It is an approach for architecting software design by looking at software in top-down approach.
In domain-driven design, the domain layer is one of the common layers in an object-oriented multilayered architecture.
Your domain object can have events that notify the outside that things are happening inside.
Your infrastructure can attach to these events to log what's needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With