Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DDD. Domain model and logging

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)?

like image 355
Arnis Lapsa Avatar asked May 19 '09 12:05

Arnis Lapsa


People also ask

What is a domain event DDD?

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.

What is a DDD model?

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.

Which of approach we can use for domain driven design?

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.

Is DDD an architecture?

In domain-driven design, the domain layer is one of the common layers in an object-oriented multilayered architecture.


1 Answers

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.

like image 144
thinkbeforecoding Avatar answered Sep 23 '22 00:09

thinkbeforecoding