How do SOLID principles apply to domain-driven design?

Answer

SOLID and Domain-Driven Design (DDD) are deeply complementary. DDD's Bounded Contexts enforce SRP at the macro level — each context has a single, well-defined domain responsibility. DDD's Domain Entities and Value Objects benefit from SRP (no persistence, serialization, or presentation logic in domain models) and OCP (domain behavior extended via Specifications, domain events). DDD's Repository pattern is a direct application of DIP — the domain layer depends on a repository interface, and the infrastructure layer provides the implementation. DDD's Domain Services and Application Services follow SRP by separating domain logic from coordination logic. LSP is important in DDD's aggregate hierarchies — subtypes must honor the root aggregate's invariants. ISP manifests in DDD's Context Maps — each bounded context only exposes the interface needed by consuming contexts.