38 ms·
It's a very related problem. I agree: All models are wrong; some are useful. A string is a wrong model for an email address. But it's a pretty useful one. A
by musingsole 4y ago
It's a very related problem.
I agree: All models are wrong; some are useful.
A string is a wrong model for an email address. But it's a pretty useful one.
A custom type sitting lonely in an isolated codebase IS ALSO A WRONG MODEL. Arguably, it might be more a useful one than a string. But that's debatable.
And on that debate, I'll argue a string is a better model because it is a better UNDERSTOOD model by more PEOPLE than whatever MyEmailClassForThisProject you just came up with.
- Ygg2 4y ago> It's a very related problem. It's not. You have the same problem regardless of type you place there. > A string is a wrong model for an email address. But it's a pretty useful one. Depends on use case. Perhaps it's an overkill in this toy example. I've real life use cases with untrusted user input where having raw string as untrusted and some kind of verified type as trusted would eliminate whole swath of errors.