January 2018
Beginner to intermediate
312 pages
7h 22m
English
In the earlier discussion on modeling simple values, we saw that they should not be represented by string or int but by domain-focused types such as WidgetCode or UnitQuantity.
But we shouldn’t stop there, because it’s very rare to have an unbounded integer or string in a real-world domain. Almost always, these values are constrained in some way:
An OrderQuantity might be represented by a signed integer, but it’s very unlikely that the business wants it to be negative, or four billion.
A CustomerName may be represented by a string, but that doesn’t mean that it should contain tab characters or line feeds.
In our domain, we’ve seen some of these constrained types already. WidgetCode strings had to start with a ...
Read now
Unlock full access