16
Specification pattern is a common pattern used in DDD that encapsulate business logic to respond to one question.
public interface ISpecification<T>
{
bool IsSatisfiedBy(T aSource);
}
public class CustomerHaveDiscountSpec : ISpecification<Customer>
{
bool IsSatisfiedBy(Customer aCustomer)
{
/* ... */
}
}
Which other patterns are common in Domain-Driven Design?