Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Chris Kiehl

Rating No ratings yet

No description

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical guide to modeling business data as explicit, immutable values in Java, so your code communicates meaning instead of hiding it behind mutable objects and nulls. Best for Java developers who have felt the pain of unclear domain models and want a concrete alternative to object-first design. 【Book Arc】 - **Opening (~0%–10%)**: Establishes the core problem — objects and primitive types like `String id` fail to communicate what data *means*, forcing developers to chase domain knowledge outside the code. Introduces the idea that data-orientation is not anti-object but about placing objects where they excel. - **Early (~10%–32%)**: Builds the conceptual foundation: values vs. identities, immutability, Java records as value carriers, constructor validation, and the danger of `null` undermining your model. Shows how mutable collections and "poison" references convert values back into identities. - **Middle (~39%–48%)**: Walks through realistic modeling exercises (e.g., a rocket checklist domain) where mechanical JSON-to-Java translation produces the right shape but wrong meaning. Demonstrates how requirements changes expose cracks in the model and how defensive coding signals a mismatch between code meaning and data meaning. - **Late (~48%+)**: Continues refining models through iterative redesign — resetting, re-deriving, and learning to recognize where meaning diverged. The excerpts do not cover the final chapters' full conclusions. 【Key Takeaways】 - **Objects are tools, not the one true way** (Opening): The mental shift is about *where* you use objects — at boundaries for encapsulation and resource management — not eliminating them. This reframing makes data-orientation compatible with existing Java codebases. - **Code should communicate data semantics directly** (Opening): A `String id` tells you nothing; an explicit type or named state tells you exactly what something is. The cost of unclear representation is paid by every reader who has to reverse-engineer meaning from production traffic or tribal knowledge. - **Values are immutable and identity-free** (Early): Values like the number 4 just *are* — they don't change, and equality is determined entirely by state. Modeling data as values eliminates whole categories of bugs related to shared mutable state. - **Java's mutable-by-default collections are a semantic trap** (Early): `new ArrayList<>()` creates an identity; `List.of(...)` creates a value. The same type can mean different things depending on the constructor, and a single mutable reference "poisons" an otherwise immutable structure. - **Records are transparent carriers — validate in the compact constructor** (Early): Records don't protect you from garbage data; they faithfully carry whatever you give them. The constructor is where you enforce invariants and reject invalid states. - **Nulls rob you of trust in your representation** (Early): If something says it's a `String`, it should always be a `String`. Optionality is valuable domain information that should be modeled explicitly, not hidden behind null checks. - **Mechanical translation from JSON produces the right shape but wrong meaning** (Middle): Mapping JSON types one-to-one to Java types is a thoughtless process that often misses what the data actually represents. The real work is asking what each piece of data *means* in the domain. - **Defensive coding is a signal that your model is wrong** (Middle): When you find yourself patching cracks with null checks and workarounds, it's a sign that the meaning in your code has diverged from the meaning in your data. Recognizing this friction is the first step to fixing the model. 【Reading Tips】 - **Deep-read the Opening and Early chapters** — they establish the conceptual vocabulary (values, identities, data, meaning) that the rest of the book depends on. Skimming here will make later modeling exercises feel arbitrary. - **Treat the Middle chapters as case studies, not recipes** — the rocket checklist example deliberately goes down wrong paths. Read for the *process* of recognizing friction and resetting, not for a final answer to copy. - **Pay attention to the "wrong path" sections** — the author explicitly says the book is a collection of his errors. The value is in building intuition for what bad modeling *feels* like, so you can catch it in your own code. - **Keep a mental checklist of Java-specific traps** — mutable collection constructors, `Arrays.asList` gotchas, null defaults, and record validation. These are the concrete tools you'll apply immediately. - **Don't expect a single large project** — each chapter has self-contained examples. Take notes on patterns across examples rather than trying to follow one continuous codebase. 【Coverage Limits】 This guide covers the first 8 chapters (MEAP) based on stratified excerpts. Later chapters and the book's full conclusions are not represented; specific advanced topics beyond the modeling exercises shown may exist but are not covered here.
Page 7
n as a whole. The pressure nudges us in the right direction. However, this design pressure can get in the way when we’re dealing with certain kinds of busine...
View in text
Excerpt 2
operties to emerge in the code. Often while programming, we encounter something that feels “off”, but we can't really articulate why it feels off. By spendin...
View in text
Excerpt 3
our modeling efforts at a moment’s notice: null. Listing 2.45 Creating a piece of “data” that consists entirely of nulls Person person = new Person(null, nul...
View in text
Excerpt 4
if we just left Statuses as their own model and referenced them elsewhere as needed? One argument for this approach is that these status records will be the...
View in text
Excerpt 5
ApprovalsAPI { enum Status {PENDING, APPROVED, DENIED} record Approval(String id, Status status){} Approval createApproval(CreateApprovalRequest request); #B...
View in text
Excerpt 6
and semantic imperfections, seems like a good option to me. It conveys something useful to the reader, and that’s enough to make it valuable. This is the des...
View in text
Excerpt 7
, but what should it look like? How would we design it as a deterministic function? What is it that CustomerRating deterministically maps to? Listing 6.17 De...
View in text
Excerpt 8
ill without doing additional work. An Assessment is exactly three cases, not two cases plus anything that’s “not those other two”. Data is cheap. It’s OK to...
View in text
Tags
AI categories
JavaSoftware
Publish Year: 2025
Language: English
File Format: PDF
File Size: 8.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…