Specification Pattern

Noun · Development

Definitions

  1. A domain-driven design pattern that encapsulates a business rule into a reusable, composable object with an isSatisfiedBy(candidate) method. Specifications can be combined using AND, OR, and NOT operators, allowing complex filtering and validation logic to be built from simple, testable predicates.

    In plain English: A pattern for turning business rules into small, reusable building blocks that can be combined like Lego to express complex conditions.

    Example: "We composed an EligibleForDiscount spec from IsReturningCustomer AND HasOrderAbove(100) so the promotion logic reads like the business rule."

Related Terms