TechWorkRamblings

by Mike Kalvas

202312091434 Have a single source of truth for invariants

#new

Every piece of knowledge must have a single, unambiguous, authoritative representation in your system.1

Even though I do not generally like the DRY principle because of its over-generalization, misdirection, and ease of misuse (202204262054 Prefer duplication over the wrong abstraction), I do think that it can be helpful when discussing sources of truth.

For instance, an application should only have one authoritative way to get an object or model where important invariants and business rules can be housed. Then we know that everyone who's making a new user or something will have e.g. the same validation requirements.


  1. Thomas, D., & Hunt, A. (2019). The pragmatic programmer, 20th anniversary edition: Journey to mastery (Second edition) (pp. 31). Addison-Wesley.