A system can represent change without mutating one long-lived object. Treat each meaningful moment as data, then derive the next state from it. Like frames of a tossed ball, successive values can preserve the continuity people recognize as identity while leaving each frame available to inspect, persist, or send elsewhere. section 2.4
For domain design, a transformation is a deliberate data-in/data-out boundary: one representation enters, another leaves. Start by naming the input and output types before deciding how the arrow is implemented. This keeps attention on the business story rather than on methods, storage, or control flow. section 5.3 section 5.3.1
Turning overdue invoices into a fee
A late-fee workflow becomes clearer when its intermediate states carry meaning: List<Invoice> → List<PastDue> → LateFeeDraft → LateFeeInvoice. The PastDue type says why an invoice qualifies; Draft says the proposed invoice is not official until it reaches the billing system. Each transformation exposes a requirement that nested conditionals can hide. section 5.3.1
Listing 5.8 Refining how late fees get produced in our system
List<Invoice> #A -> List<PastDue> #B -> LateFeeInvoice #C
Read the pipeline left to right: each arrow produces a more specific representation, making the fee rule and its prerequisite state visible. section 5.3.1
Use transformations to make a domain model easier to change:
- Invent types freely while exploring; postpone their fields and implementation until the sequence tells the right story. section 5.3
- Prefer representations that balance domain meaning, usability, and safety; wrapper types can record what is known about a state. section 5.9
- At a legacy boundary, map a semantic type deterministically into the existing entity instead of reshaping the domain model around persistence. section 6.4.1 section 6.4.2
Transformation boundaries also make integration choices explicit. A LateFee can remain a well-typed domain value, then be translated to a generic Invoice only when existing repositories must save it. The mapping is tedious, but it isolates legacy assumptions and lets the newer model grow without immediately replacing surrounding machinery. section 6.4.1 section 6.4.2






















