← Graph

Invalid States Impossible

concept 1 connections

Practice of using a type system — in Ruby via Literal, at runtime — to make invalid object states unrepresentable. Rather than validating ad hoc, constrain properties at the object boundary (e.g. a Coordinates object whose latitude is a Float in -90..90) so that once an object exists, its state is guaranteed valid. Joel Drapper argues this is strictly better than silent corruption: raising early is preferable to deleting thousands of records while the system happily continues.

category
practice
about
Invalid States Impossible concept
Types at object boundaries make invalid states unrepresentable.

Provenance

Read by
1 extraction