Domain Instrumentation: Keeping Use Cases Expressive

Instrumentation is essential in any application: logs for debugging, metrics for monitoring, and traces to understand execution flow. But when this instrumentation is mixed directly into use cases, the code becomes difficult to read, maintain, and especially, to test. In this post, I’ll explore a pattern I regularly apply: abstracting instrumentation behind domain-specific interfaces, keeping use cases expressive and focused on business logic. Additionally, it helps me postpone infrastructure decisions and dramatically improves test quality. ...

December 5, 2025 · 6 min · Pascual Montesinos

Domain Events vs Integration Events

In event-driven architectures, it’s useful to distinguish between events based on their purpose: communication within the domain versus integration between bounded contexts. This distinction helps better manage coupling and system evolution. The Context When everything is modeled as “an event,” tensions emerge. A single message attempts to serve two different purposes: Communicate domain facts to coordinate reactions within the bounded context. Expose state changes as an integration contract with other bounded contexts. For example, when a product is put on sale in an e-commerce system: ...

November 21, 2025 · 6 min · Pascual Montesinos