liveBook · Manning

Unit of measurement

As explained in Data-Oriented Programming in Java

A unit is a defined reference quantity used to express and compare measurements of a property.

A unit gives a measurement its meaning. A value such as 4 is not enough: temperature requires a unit such as Fahrenheit or Kelvin, while elapsed time requires a precise definition of what a “day” represents. section 2.3 section 3.1

Before choosing a representation, establish:

  • What property is being measured and which unit expresses it. section 2.3
  • What the permitted range and precision are. section 3.1
  • Whether observations are continuous, discrete, or sparse rather than assuming their sequence from the field name. section 3.1 section 2.3

Drying-oil measurements

A mechanical Java translation might store daysElapsed as an int and contactAngle as a double. Domain notes make the semantics explicit: elapsed days are nonnegative and sparse, while contact angle is measured in degrees from -180° inclusive to 180° exclusive, with precision to one hundredth of a degree. A sequence such as days 1, 3, 4, 7 therefore represents the measurement design, not missing data. section 3.1

Listing 3.4 Writing down our understanding of daysElapsed
                     Domain Notes.md
=========================================================
SampleID: Unknown
 
Days Elapsed: 
    A positive integer (0 inclusive). 
    Not strictly daily. Will be Sparse. 

Contact Angle: Unknown

Use the domain notes to inspect how a vague field becomes a documented measurement with a unit, range, and sampling rule. section 3.1

How Data-Oriented Programming in Java covers it

How deep it goes
Works through unit ambiguity, sampling behavior, range, and precision, then stops short of a dedicated unit type.
Examples
Uses temperature values, elapsed days, and drying-oil contact angles to expose unit and precision decisions.
What you can do after
Evaluate measurement fields by identifying their units, ranges, precision, and sampling assumptions before choosing types.
How it connects
Connects units with domain modeling, type representation, invariants, and measurement fidelity.

Also explained in

Compare how 4 books explain unit of measurement →

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.