3 ms·
That sounds like an argument against excess validation rather than against types (maybe because of blog-driven development showing minimal examples of the power
by hansvm 4y ago
That sounds like an argument against excess validation rather than against types (maybe because of blog-driven development showing minimal examples of the power of types?).
Picking on one of those points, suppose emails are just strings. What then prevents them from getting used as names, identifiers, and other unrelated data? Just your continued vigilance as a programmer and hoping that nobody ever carelessly names the field "address" so that mistakes can slip by over a series of devolution commits.
You might not know much about what an email is, but you know _something_ about how you expect them to behave and be used, and if you like the computer to automate your work it's not totally unreasonable to rebind the string type as an email type and require explicit conversions at the point of use to treat it as anything other than just an email. There's zero runtime cost, it's not much more code, and that class of bugs is greatly reduced except for at the boundaries of the system.
Maybe that effort isn't worth it, or maybe your domain changes fast enough you'd have a lot of churn, or maybe those bugs aren't too important, or whatever. Using types to help you reason about the things you do know and do care about can be a huge productivity boost though, so I wouldn't just write the whole technique off.
- indymike 4y ago> That sounds like an argument against excess validation rather than against types (maybe because of blog-driven development showing minimal examples of the power of types?). A lot of developers confuse types and validation.