liveBook · Manning

Data model

As explained in Data-Oriented Programming in Java

A database model is a structured representation of data entities, attributes, and relationships as persisted by a database.

A data model makes domain meaning explicit instead of hiding it behind flags, nulls, or overloaded fields. The right representation can make illegal states impossible to express and clarify the intentions behind assignments. section 1.7

A practical data model:

  • Uses concrete types for business meanings rather than ambiguous conditional conventions. section 1.7
  • Selects only the data needed for the task instead of reproducing an official entity with all its accumulated baggage. section 8.1
  • Lets object-oriented code grow around descriptive data, complementing rather than replacing objects. section 1.7
  • Makes methods communicate through descriptive inputs and return types instead of hiding information in zero-argument operations. section 1.7

Routing a customer account

Represent an account with an AccountId, Region, CountryCode, Sector, Segment, and SalesChannel. Enums capture bounded categories such as Enterprise, Direct, or EMEA, while a custom Sector record wraps an arbitrary string. This compact model supports business rules without exposing every field scattered across databases, data lakes, and services. section 8.1

Figure 8.3 Good modeling hides complexity we don’t care about.

Shows how a focused data model hides infrastructure and entity complexity that the immediate business task does not require. section 8.1

How Data-Oriented Programming in Java covers it

How deep it goes
Works through semantic types and a customer-account representation, stopping short of a complete enterprise entity.
Examples
Uses a customer Account composed of identifiers, enums, country and regional codes, segments, channels, and a Sector record.
What you can do after
Build it from scratch with plain data, records, enums, and descriptive types tailored to a business task.
How it connects
Connects data modeling with data-oriented programming, object-oriented design, records, enums, and illegal-state prevention.

Also explained in

Compare how 26 books explain data model →

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.