Checking an Invariant at a Component Boundary
A boundary check can identify invalid state before another component assumes it is usable.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Check an ordinary example
A queue exporter can compare a separately tracked count with the number of items it will report. A mismatch suggests an earlier update failed to keep them coherent. Compare representation invariants.
Choose the right failure behavior
For external input, a validation error can help a caller supply correct data. For private inconsistent state, capture the relevant operation and protect the remaining data from further writes. Diagnostic log context helps identify useful evidence.[1]