liveBook · Manning

Hidden knowledge

As explained in Data-Oriented Programming in Java

Hidden knowledge is information about required behaviors, assumptions, or validity conditions that exists in code but is not stated in requirements or exposed at an interaction boundary.

Hidden knowledge is information about required behavior, assumptions, or validity conditions that exists in code but remains unstated in requirements or hidden beyond an interaction boundary. It becomes dangerous when later methods depend on facts that earlier validation never established. section 9.2.4 section 9.6

A cart item that is valid too late

An add-to-cart request validates productId and quantity, then constructs a CartItem while sellerId is still null. The item passes through processing before sellerId is assigned. Because productId and sellerId form the qualified identity, the cart can admit a duplicate. Each method looks reasonable in isolation; the invalid state appears only through their sequence. section 9.2.4

Make hidden knowledge visible by:

  • Working backward from invariants instead of assuming that a sequence of setters will preserve them. section 9.6
  • Treating validation as a boundary whose exit is guarded by data that proves validity. section 9.6
  • Using constructors and data types to prevent incomplete or illegal states from being represented. section 9.6
  • Separating parsing from later decisions so partially constructed objects do not silently propagate invalid data. section 9.6

How Data-Oriented Programming in Java covers it

How deep it goes
Traces partial construction, sequential coupling, null propagation, and invariant-preserving data types.
Examples
Uses a cart item whose missing sellerId defeats identity checks and permits duplicate cart entries.
What you can do after
Diagnoses invalid-state paths and redesigns boundaries so constructors or data types enforce required evidence.
How it connects
Connects partial construction with shotgun parsing, sequential coupling, mutation, validation, invariants, and data types.

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.