wordfor

parse, don't validate

phrase

Software design

  1. Converting untrusted input into a precise type once at the boundary, instead of re-checking raw values throughout the code. Parse a string into an EmailAddress type at the API boundary; downstream code never sees raw strings.

In plain words

  • checking the same input everywhere
  • validation scattered all over the code
  • check it once at the edge

See also make illegal states unrepresentable invariant

Find similar words