liveBook · Manning

Domain semantics

As explained in Data-Oriented Programming in Java

Domain semantics are the meanings and validity rules that a software model assigns to concepts in its problem domain.

Domain semantics are the meanings and validity rules assigned to concepts in a problem domain. The integer 4 becomes data when it represents a temperature, age, or voltage; its domain meaning determines what the value means and which uses are valid. section 2.8

Discovering semantics requires asking what something is, rather than merely recording how it is represented. A field’s character pattern describes syntax, but understanding its meaning requires identifying the concepts inside it and the invariants they impose. section 3.1.1 section 3.1.2

From sample identifier to domain model

A Sample ID initially appears to be an alphanumeric string such as "UV-1". Deeper analysis reveals that it is a pair: a curing method, restricted to AIR, UV, or HEAT, and a non-negative sample number. Those meanings become invariants rather than assumptions hidden in strings. section 3.1.1

Listing 3.6 Incomplete domain analysis
                     Domain Notes.md
=========================================================
 
SampleID: 
    Alpha-numeric + special characters

Days Elapsed: 
    A positive integer (0 inclusive) 
    Not strictly daily. Will be Sparse

Contact Angle: 
    Degrees from -180° (inclusive) to 180° (exclusive)
    Precision of 100th of a degree

Use the domain notes as a starting checklist: record representations and ranges, then continue questioning until the concepts and invariants behind them are explicit. section 3.1.1

Once meaning is understood, encode it in types and validation. Records and value classes provide concise representations, while constructors can reject or transform invalid input. Strong modeling aligns the meaning of a type with the meaning of its data, making incorrect states difficult to create. section 2.8 section 3.6

How Data-Oriented Programming in Java covers it

How deep it goes
Explains analysis from representation through meaning and enforcement, stopping short of detailed implementation beyond validation and type modeling.
Examples
Uses Sample IDs, curing methods, sample numbers, elapsed days, and contact angles to expose hidden domain constraints.
What it assumes
Assumes programming knowledge but teaches domain understanding by starting with representations and questioning their meanings.
What you can do after
Apply domain questioning and type design to make invalid data difficult or impossible to represent.
How it connects
Connects data with values, identity, records, invariants, validation, and the type system.

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.