DEV Community

Cover image for Reactive DDD
Antonio Falcão Jr.
Antonio Falcão Jr.

Posted on

Reactive DDD

There are two ways to decompose and integrate distributed systems. One is easy, and the other one is better. The easy way to do things is orchestrated or declarative. The basic idea of an orchestrated system is that one entity tells another entity what to do. The other way to organize your services is through choreography and/or reactivity. Choreography solves the problems we face in declarative systems, like high coupling and low cohesion.

"Changes in downstream services may not disrupt upstream services."

Reactive DDD (Domain-Driven Design) is an approach to software development that combines principles from Domain-Driven Design and Reactive Programming to build highly extensible, scalable, and resilient systems. Reactive DDD focuses on modeling the domain's behavior in distributed, event-driven, inherently reactive systems.

Subdomain decomposition is an essential part of DDD, and in Reactive DDD, the subdomains are decomposed to support Choreographed event-driven architectures. Each subdomain is responsible for managing its own state, and changes to that state are communicated through events.

Event-Sourcing is the most efficient/appropriate persistence strategy here, given the eventual nature of the design. But it's subject to another post.

In an eventual and unpredictable environment about when an event occurs, how often the broker will deliver it, and in what order the subscriber will process it, Reactive DDD can help ensure that the system remains responsive and resilient by modeling such "uncertainties."

By modeling the domain as a set of reactive components that communicate through events, the system can be designed to handle large volumes of requests, maintain consistency and reliability, and gracefully recover from failures.

Reactive DDD is a modern and trendy approach becoming increasingly popular for building complex distributed systems. It provides a way to decompose a domain into smaller, more manageable pieces and design them to support a reactive architecture. This can lead to more responsive, scalable, and resilient systems and can better handle the demands of an eventual environment.


If you're interested in modeling uncertainty with Reactive Domain-Driven Design (DDD), here are a few resources that might be helpful:

Oldest comments (0)