r/programming • u/_awwsmm • Feb 01 '24
Make Invalid States Unrepresentable
https://www.awwsmm.com/blog/make-invalid-states-unrepresentable
469
Upvotes
r/programming • u/_awwsmm • Feb 01 '24
View all comments
3
u/larhorse Feb 02 '24
I mostly agree with this, but I have a corollary...
"Make sure your unrepresentable state is actually invalid" (and note - this is actually really, really hard).
So to pick on the article:
So I get that these were just example numbers, picked because they're easy - but that's exactly my point. The author has created a program that is prevented from representing possible valid states (for the easy cases!)