Hacker News new | past | comments | ask | show | jobs | submit login

Very useful for DDD, like having an Email type, or String100 (string of 100 characters)



Works very well too for any kind of validation or encoding. Anything that accepts input from the outside world can accept a string. And then everything else in the app can work with a "SafeString" and the only way to create a safe string is to send a string through a string escape function (or whatever makes sense for your app).

Works especially well if you're using any kind of hexagonal architecture, make your functional core only accept validated/escaped/parsed/whatever types, and then the imperative shell must send any incoming data through whatever transformation/validation/etc before it can interact with the core.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: