liveBook · Manning

Data

As explained in Data-Oriented Programming in Java

Data is information represented independently of the behaviors that operate on it.

Data is a value made about something. The number 4 becomes data when it represents a temperature, sales total, age, or voltage; that domain meaning raises questions about units, fidelity, use, and valid ranges. Representation is the work of carrying those answers into code. section 2.3 section 2.8

Data orientation does not discard objects. Objects can encapsulate state and enforce boundaries, while data becomes the primary medium for describing domain facts, decisions, actions, and changing identities. The design pressure shifts from attaching behavior to an entity toward making the represented meaning explicit. section 1.1 section 2.3.1

Model data deliberately:

  • Choose types that communicate distinctions a bare primitive or string would hide, then validate at construction so invalid data cannot enter the model. section 3.7
  • Use records for compact immutable value and data classes; use sealed interfaces and records to express fixed alternatives and combinations. section 2.8 section 4.9
  • Create a purpose-built view when an existing entity carries irrelevant baggage, accepting mapping code at the boundary as its cost. section 5.7
  • Keep domain data at the core and adapt databases, cloud stores, HTTP, JSON, and other dependencies around the edges. section 10.4.2 section 10.4.8

Rules as inspectable data

Represent account-routing rules with data types such as Equals, And, Or, and Not rather than burying them in conditionals. A pattern-matching interpreter can evaluate the same rule data; serialization, documentation, visualizations, and a future rule-building UI can reuse it without parsing source code. section 8.5 section 8.10

Data-centric functions are easier to test when they take explicit input data and return output data: scenarios live in the test rather than in clocks, service mocks, or hidden setup. Even side-effects can be specified and asserted as data. section 11.2 section 11.3.3

How Data-Oriented Programming in Java covers it

How deep it goes
Defines data as meaningful values, then develops representation through types, algebraic models, interpreters, boundaries, and tests.
Examples
Uses temperature, electricity usage, sales, retry decisions, invoices, customer accounts, routing rules, CSV parsing, and notification tests.
What it assumes
Assumes Java programming and contrasts familiar object-oriented and imperative styles without requiring data-oriented design experience.
What you can do after
Apply it via Java records, sealed interfaces, pattern matching, and validation to model semantics and keep invalid states out.
How it connects
Connects values, identity, records, sealed interfaces, algebraic data types, domain modeling, interpreters, and testing.

Also explained in

Compare how 10 books explain data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Oriented Programming in Java. The section links point to the parts of the book it draws on.