liveBook · Manning

Operation

As explained in Data-Oriented Programming in Java

An operation is a rule that combines or transforms values from a specified set to produce a value.

An operation combines or transforms values from a specified set to produce a value. In an algebraic design, operations are deterministic functions: data goes in, data comes out, without side effects or void methods. This makes their meaning open to equational reasoning rather than being hidden inside implementation steps. section 7.2

The useful design question is not how to execute an operation, but what it means. For conflicting records, that might mean defining what it means to “add” two records. The same move applies to business rules: equality checks, conjunction, disjunction, and negation can all be represented as data. section 7.2 section 8.4

Modeling operations as data enables several practical improvements:

  • Represent an operation explicitly instead of burying it in conditional control flow. section 8.3
  • Use enums for attributes instead of unrestricted strings, allowing the type model to reject invalid attribute names. section 8.3
  • Unify related operations under a sealed interface, forming a closed algebra of equality, AND, OR, and NOT. section 8.4
  • Add constructors and fluent methods after the model is correct, reducing the verbosity of composing operations. section 8.4

A composable rule operation

A rule can express “country is US and segment is Public, or region is not LATAM” as data: eq(COUNTRY, "US").and(eq(SEGMENT, "Public")).or(not(eq(REGION, "LATAM"))). Unlike a fixed conditional branch, this representation can be transformed as data.

How Data-Oriented Programming in Java covers it

How deep it goes
Derives equational reasoning and a sealed rule algebra, but stops short of explaining operation evaluation.
Examples
Uses record merging, equality checks, enum-backed attributes, and composed AND, OR, and NOT rules.
What it assumes
Assumes object-oriented design familiarity while introducing algebraic modeling through small examples rather than formal mathematics.
What you can do after
Build it from scratch as explicit data, compose it fluently, and reason about its meaning independently of implementation.
How it connects
Connects operations with algebra, deterministic functions, equational reasoning, business rules, sum types, and sealed interfaces.

Also explained in

Compare how 3 books explain operation →

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.