liveBook · Manning

Equation

As explained in Data-Oriented Programming in Java

An equation is a statement that two expressions have the same value or meaning.

An equation states that two expressions have the same value or meaning. In programming, it can relate two pieces of data or two pieces of code that behave identically. section 7.1 section 7.2

An equation shifts attention away from implementation details and toward what code should mean. Once two expressions are understood as equivalent, a complex expression can be substituted with a simpler one. section 7.2

Combining conflicting records

When duplicate rows conflict, write an equation that asks what it means to “add” two records. The equation does not prescribe lists, loops, or data structures; it isolates the meaning of the operation before implementation. The resulting meaning can support laws that apply to every possible input and tests that check whether the implementation is correct. section 7.1 section 7.2

Use equations to make software meaning explicit:

  • Define the data being related and the operation applied to it. section 7.2
  • Ask what the equation means independently of its implementation. section 7.2
  • Turn the resulting laws into tests over possible inputs. section 7.1
Figure 7.3 An exciting first example!

A visual first example makes functional equivalence between two expressions concrete before introducing broader algebraic laws. section 7.2

How Data-Oriented Programming in Java covers it

How deep it goes
Defines equations, substitution, and universal laws, but stops short of formal formulas or implementation details.
Examples
Uses conflicting duplicate records and the operation of adding two records as concrete examples.
What it assumes
Assumes Java familiarity while teaching the needed logic, set-theoretic ideas, and algebraic framing from basic examples.
What you can do after
Evaluate correctness by stating domain laws and testing whether implementations preserve them across possible inputs.
How it connects
Connects equations with algebra, deterministic functions, equational reasoning, laws, substitution, and correctness testing.

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.