SOLID & Design Patterns Interview Question #76

What is a Bounded Context in Domain-Driven Design?

DDD Boundaries, Resilience, Caching & Practical ASP.NET Core Design Mid-Level Intermediate

Quick Interview Answer

A Bounded Context is an explicit boundary within which a particular domain model and its terminology are valid. The same real-world concept can have different models and meanings in different contexts.

Detailed Explanation

A Bounded Context is an explicit boundary within which a particular domain model and its terminology are valid. The same real-world concept can have different models and meanings in different contexts.

Bounded contexts help prevent one large model from becoming ambiguous or tightly coupled. Integration between contexts should happen through deliberate contracts rather than by sharing every internal domain class.

Code Example

// Sales context
public class Customer
{
    public Guid Id { get; init; }
    public CreditLimit CreditLimit { get; init; }
}

// Support context may model Customer differently.