Excerpted from DomainDrivenDesignBook
Problem: Business rules often do not fit the responsibility of any of the obvious
Entities or
ValueObjects, and their variety and combinations can overwhelm the basic meaning of the domain object. But moving the rules out of the domain layer is even worse, since the domain code no longer expresses the model.
Logic programming provides the concept of separate, combinable, rule objects called "predicates", but full implementation of this concept with objects is cumbersome. It is also so general that it doesn't communicate intent as much as more specialized designs.
Solution: Create explicit predicate-like
ValueObjects for specialized purposes. A
Specification is a predicate that determines if an object does or does not satisfy some criteria.
Specification is mentioned on: DeclarativeDesign | MessagesByTopic | ADesignCallingForAFacadeSolution | AggregateBoundries | EarlyVsLateIntroductionOfRDB | TerminologyQuestionOnValueObjectsAndEntities | DomainObjectsAndBusinessRules | Glossary | RepositoriesAndAutomatedPersistence | StreamlinedObjectModeling | LazyLoad