Data-oriented programming (DOP) organizes design around what data means and how its representation communicates that meaning. Rather than leaving domain rules implicit in strings, flags, nullable fields, and scattered conditionals, model state as explicit, well-typed data—ideally immutable—so readers and the compiler can see what is valid. section 1.0 section 2.3
A vague `String id` says only that any string is acceptable, even when the domain requires a UUID. Changing the representation to `UUID` narrows the possible states to ones that match the known meaning. The point is not defensive checks everywhere; it is choosing representations that prevent mismatches from being expressed. section 1.2
Make hidden task state explicit
A scheduler that uses `scheduledAt == null` and `attempts` to imply cancellation, delayed retries, or immediate retries forces every caller to reconstruct those rules. Represent the alternatives directly as `RetryImmediately`, `ReattemptLater`, and `Abandoned` decisions. A caller can then remove abandoned tasks by checking for `Abandoned`, rather than interpreting a null timestamp. section 1.3.1 section 1.3.2
DOP complements object orientation rather than replacing it. Objects can still enforce boundaries and encapsulate state; explicit data improves the semantics on either side of those boundaries and can drive clearer interfaces. Prefer operations whose inputs and return types reveal the transformation over zero-argument `void` methods that conceal it. section 1.1 section 1.4
Use data orientation as a design loop:
- Ask what each value is in the domain, including units, fidelity, identifiers, and meaningful states; encode the answer in its type. section 2.3
- Treat behavior as a transformation from one named data shape to another, including before-and-after states around external calls. section 5.3
- Explore representations iteratively, favoring models that balance semantics, ergonomics, and safety instead of reusing ill-fitting entities. section 5.9
- Introduce wrapper types at legacy boundaries when a full immutable redesign is not warranted; use the wrapper to quarantine mutability and clarify intent. section 5.4.1
- Move important invariants into types when appropriate, using records, sealed interfaces, and generics to make illegal behavior fail at compile time. section 5.4.5 section 4.9
Listing 10.22 The finished data pipeline
NOTES.md
------------------------------------------------------
String
-> JSON
-> Manifest
-> ResourceName
-> List<RawCsvRepresentation>
-> List<DomainRepresentation>
-> UpdatesAndInserts
Done!A pipeline sketch makes architecture visible as successive data shapes, from raw serialized input through parsing and domain representations to updates. section 10.3
More types and boundary-mapping code are real costs, not evidence of failure. The tradeoff is often a model whose requirements are visible in one place instead of distributed as hidden assumptions through a codebase. For performance concerns, measure rather than assuming additional small data types are the bottleneck. section 5.7 section 1.4





