166 Physical independence

Derived attributes are logical predicates whose values are defined by folds over event histories. Whether these values are materialised, cached, or computed on demand is an implementation detail outside the type system.

The logical layer defines:

  • predicates
  • constraints
  • derived attributes
  • fold semantics
  • evolution rules
  • component provenance

This layer is pure meaning. It says what is true, not how it is stored.

The physical layer (backend implementation), if it even exists may:

  • materialise derived attributes
  • compute them on demand
  • cache them
  • index them
  • denormalise them
  • store them in columnar or document form
  • represent database-state locations as in-memory objects or slots
  • track dirty objects or dirty pages inside a transaction
  • persist committed changes through a log-structured store, write-ahead log, or snapshot format
  • replay events or maintain snapshots