Skip to content
Tomer Gabel edited this page Dec 11, 2013 · 2 revisions

Design goals

Accord was built with four principal design goals:

  • Minimalistic: Provide the bare minimum functionality necessary to deal with the problem domain. Any extended functionality is delivered in a separate module and satisfies the same design goals.
  • Simple: Provide a very simple and lean API across all four categories of call sites (validator definition, combinator definition, validator execution and result processing).
  • Self-contained: Reduce or eliminate external dependencies entirely where possible.
  • Integrated: Provide extensions to integrate with common libraries and enable simple integration points where possible.

We also started off with a number of desirable traits that may or may not make (or have made) it into the library, listed from the most to the least important:

  • Avoid user-specified strings in the API (this includes scala.Symbols). This manifests in two ways:
    • Validation rules cannot be executed via reflection; and

    • Descriptions are automatically provided for expressions being validated. For instance, when validating the expression someInstance.someField, a violation message should include not only the value of the expression but also a textual representation of the field itself (for example, when validating someInstance a meaningful violation message would be someField must not be empty).

      The rationale behind this is that, in contrast with most testing frameworks - where a failed assertion typically halts execution or at least provides a stack trace to reference the code - a runtime validation engine should provide for multiple rule violations, and can/should not point to the code.

  • Performance comparable with, or better than, common JSR 303 providers (specifically Hibernate Validator and Apache bval) at runtime.

Overall architecture

WIP

Clone this wiki locally