Skip to content

BeerId structure #6801

Closed Answered by DamnClin
GenFlogi asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

This is done to avoid primitive manipulations and type everything.

In my domain, all IDs will typically be UUID so I want to type them since, as an example, a BeerId is not a ShopId.
Another reason is to attract features: If I have a type wrapping a primitive, if I need to do something on that primitive it will be natural to add the operation in the wrapper class. With a really low cost I'll end up with very specialized, easy to tests classes (and this is a good news)

You can look for Type Driven Development or read "Domain Modeling Made Functional - Scot Wlashin" for more on this approach

Hope that helps

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by GenFlogi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants