1 Data Oriented Programming
Data-oriented programming centers software design around explicit representations of domain data, treating data as values independent of classes and behavior. The goal is to first ask “What is it?” and encode that meaning directly in the code so programs describe themselves. Objects are still valuable—especially for managing resources and enforcing boundaries—but they are treated as tools that sit atop a clearly modeled data core rather than as the sole organizing principle.
The chapter illustrates how precise representation simplifies systems: replacing a vague String id with a UUID aligns code with domain semantics, eliminates illegal states, and removes defensive checks. A larger example refactors a ScheduledTask that previously relied on ambiguous field combinations into explicit data types that model decisions (e.g., retry immediately, try later, abandon). This shift bakes semantic integrity into the code, reduces guesswork, and complements object-oriented design by informing clearer interfaces (such as isAbandoned) that reflect the underlying model instead of leaking incidental state.
As systems “orient around” data, method signatures naturally take and return well-defined data (e.g., reschedule(FailedTask) -> RetryDecision), bodies become expression-oriented, and objects tend to act as pipelines that retrieve, transform, and vend data. The approach is language-feature agnostic—newer Java features like records, pattern matching, and sealed types help, but the ideas work back to JDK 8—and the book teaches through many small, real-world examples, including missteps, to build modeling intuition. The overall payoff is code that is smaller, clearer, and easier to reason about, where good representations make illegal states unrepresentable and let the object structure fall naturally into place.
Objects and how they communicate is our focus during object-oriented design

The representation of our data is the primary focus during data oriented design

Being explicit about what a task can transition to after failing

Representing each decision as a piece of standalone data

Focusing on just the data makes us question our representation

clarifying what we’re talking about

Analyzing the data drives a deeper exploration of the domain

How data-oriented programs tend to be shaped

Summary
- Data Oriented programming is about programming with data "as data"
- Data is more than just a collection of values. It has an inherent meaning.
- Modeling “data as data” lets us focus on capturing that meaning in isolation from other concerns
- Before asking “what does it do?” data orientation starts a more bedrock question of “what is it?” We want to understand what these things in our domain are at a fundamental level
- Data Orientation is not a replacement for object orientation, functional programming, or any other paradigm. We view all of them as useful tools.
- The representations we choose for our data affects our programs as a whole.
- Good representations eliminate the potential for bugs by making it impossible to create invalid data
- Bad representations introduce problems which ripple outward through our codebase and force us to spend effort working around them
- We can replace reasoning about what vague variable assignments mean by representing that meaning with a concrete data type
- Focusing on the data inside of our objects, rather than just the interfaces, makes our objects as a whole more understandable
- When we do a good job of modeling the data, the rest of the code will feel like it’s writing itself. We just have to follow where the data leads
- Data-Oriented programs tend to be built around functions that take data as input and return new data as output
- We’ll use Java 21 throughout the book (though, you can still follow along with Java 8)