In Domain-Driven Design (DDD), the Write Model is responsible for handling commands and applying changes to the system's state. It focuses exclusively on the processes involved in creating, updating, or deleting domain entities and aggregates.
In a CQRS (Command Query Responsibility Segregation) architecture, the Write Model is distinct from the Read Model. While the Write Model is optimized for processing changes, the Read Model is tailored for querying data. This separation improves scalability and maintainability.
Imagine an e-commerce system where customers place orders. The Write Model would validate and process commands like PlaceOrder
or CancelOrder
, ensuring the domain rules (e.g., inventory availability) are enforced.