liveBook · Manning

Local reasoning

As explained in Data-Oriented Programming in Java

A reasoning technique that determines a computation's behavior from its locally visible inputs, outputs, and dependencies.

Local reasoning determines a computation’s behavior from what it visibly receives and returns. Functions that take their dependencies as arguments avoid reconstructing surrounding instance state, services, and hidden mutations before their business logic becomes understandable. section 6.1.4

Local reasoning changes both implementation and testing:

  • Read behavior as a mapping from supplied inputs to returned outputs rather than as a consequence of widely distributed state. section 6.1.4
  • Test by crafting inputs and asserting expected outputs, reducing complicated setup, teardown, mocking, and subtle state orchestration. section 6.1.4
Figure 6.3 Everything we need to know is in one spot

Use the figure to contrast behavior scattered across surrounding state with behavior whose required information appears in one place. section 6.1.4

How Data-Oriented Programming in Java covers it

How deep it goes
Explains isolation, input-output behavior, and test consequences, but stops short of implementation patterns or formal guarantees.
Examples
Uses Java methods, surrounding instance state and services, input-output mappings, and test setup as concrete contrasts.
What it assumes
Assumes familiarity with Java methods and testing while teaching how explicit dependencies simplify reasoning from zero.
What you can do after
Diagnose/debug with it by tracing visible inputs and outputs instead of reconstructing distributed state and hidden setup.
How it connects
Connects local reasoning to mathematical functions, instance state, services, dependencies, mocking, and automated testing.

Also explained in

Compare how 2 books explain local reasoning →

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.