Your Assumptions Are Wrong
Author
Marcus HeldHi,
Your email validation is probably incorrect. And your model that every person has a first and last name is also incorrect.
While I was rummaging through my bookmarks in the past few days looking for an article on Project Management in BigTech , I stumbled upon an old article from 2010: Falsehoods Programmers Believe About Names .
An excellent essay!
Our Assumptions are Wrong
Perhaps you’ve already experienced that not every person has exactly one first and last name. And maybe you’ve had a support case where names change. After all, there are people who get married 😉
But there are even more extraordinary characteristics of names. There are names with numbers. Some are written in CAPSLOCK. A name is assigned years after birth. Some names are also swear words.
I could repeat Patrick McKenzie’s list now, but check out his essay .
For us as developers, however, the takeaway should be: Any assumption we make about names is wrong. For example, you should not do the following:
- Have a first and last name column
- Limit the character length of names
- Limit the character set
- Set a unique constraint
- Or apply any form of validation to the name
Your Email Validation is Also Wrong
Have you ever looked into the address specification of RFC 5322 ?
These are all correct email addresses:
long.email-address-with-hyphens@and.subdomains.example.com
name/surname@example.com
admin@example
example@s.example
" "@example.org
"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
_test@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]
(You can find more examples on Wikipedia)
I’m pretty sure your implementation does not support all these examples.
The only correct way to validate an email address is to send an activation email.
We Mean Well - But It’s Not Worth the Effort
What do we need to take away from this?
Many of our assumptions are well-intentioned - but wrong. Be aware of this. And consider it in the next grooming session when it comes to setting up a form with first and last names.
Rule the Backend,
~ Marcus