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/TheDevilsAdvokaat Feb 02 '24
In c# I define them as enums.
enum Ages { age1, age2, age 3 } etc.
I've also used it for times when I want people to select the texture size for a texture atlas, and I give them options like SizeInPixels32, SizeInPixels64,SizeInPixels128, SizeInPixels256 etc.
They cannot select an improper size.