wordfor

make illegal states unrepresentable

phrase

Software design

  1. Designing data types so invalid combinations cannot even be constructed, eliminating a whole class of bugs. Replace isLoading, isError and data with one union: Loading | Error(message) | Loaded(data).

In plain words

  • impossible combinations of flags
  • loading and error are both true at once
  • bugs from invalid states
  • booleans that contradict each other

See also finite state machine parse, don't validate invariant

Find similar words