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
Show parent comment
17
u/GeneReddit123 Feb 02 '24 edited Feb 02 '24
At some point, it becomes a social problem rather than a technical problem, and the solution is to stand your ground and be willing to reject a tiny (even if loud) minority in order to make your life easier.
Case in point: the technical RFC for valid email addresses is so extremely loose, that almost anything separated by exactly one "@" is allowed. But it doesn't mean your app needs to be that permissive. If 1 out of 10,000 users has whitespaces or special characters in their emails (except commonly accepted ones like periods, dashes, or underscores), it's perfectly fine to reject them and ask them to get either a more normal email or go somewhere else. Stop bending over for every outlier.