Skip to content

Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Follow @CodeOpinion

Domain Driven Design

ALWAYS Valid Domain Model

Always having your Domain Model in a valid state means it will be predictable. You’ll write less defensive code or conditional code because your domain objects will always be in a valid state. Using aggregates is a great way to encapsulate the state with behavior to keep the state valid. Using factories to create your aggregates is key to having a valid state from the very beginning. Here’s how you can create an always valid domain model. YouTube Check out my YouTube channel where I post all kinds of content that accompanies my posts including this video showing everything that is in… Read More »ALWAYS Valid Domain Model

STOP doing dogmatic Domain Driven Design

The mainstream thought on Domain Driven Design is about Entities, Value Objects, Aggregates, Repositories, Services, Factories… all kinds of technical patterns. Because of this, most don’t think they need Domain Driven Design because it’s complicated for their domain. Why would you need all that “stuff”? Well, maybe you don’t! In a large system, modeling your domain, defining boundaries, and how they relate is far more important than concerning yourself if you’re using the Repository pattern correctly. YouTube Check out my YouTube channel where I post all kinds of content that accompanies my posts including this video showing everything that is in this… Read More »STOP doing dogmatic Domain Driven Design

Aggregate Design: Using Invariants as a Guide

How do you compose an aggregate? For me, aggregate design involves understanding the invariants. Invariants are business rules that must always be consistent. Understanding the invariants will guide your aggregate design. Everything I seemingly post ends up being about defining boundaries! Aggregates are yet another example of defining boundaries based on invariants and consistency. YouTube Check out my YouTube channel where I post all kinds of content that accompanies my posts including this video showing everything that is in this post. Shipment The example I’m going to use is the concept of a Shipment. You could think of this as a food… Read More »Aggregate Design: Using Invariants as a Guide