A concrete type makes a value’s domain meaning visible in its representation. A variable declared as String may contain anything, while UUID communicates that the identifier has UUID semantics and excludes unrelated values. section 1.2
From vague identifier to meaningful type
String id permits values such as "Hello World!", "2024-05-04", or an IP address. Replacing it with UUID aligns the code with the stated meaning of the identifier and narrows the states the program can express. section 1.2
Concrete types improve a design by:
- Exposing domain knowledge directly in code instead of leaving readers to infer it from names, documentation, or runtime data. section 1.2
- Reducing ambiguity caused by flags, nulls, or assignments whose meaning changes according to surrounding conditions. section 1.7
- Making illegal states impossible to express when the chosen representation matches the domain. section 1.7
Listing 1.3 Changing how we represent that one line
String idUUID id #A
Compare the vague String declaration with the more communicative UUID declaration, alongside invalid identifier examples. section 1.2



