liveBook · Manning

Class

As explained in Data-Oriented Programming in Java

A Java declaration that defines a type by specifying its state representation and optionally its behavior.

A class can make domain decisions explicit by representing each permitted outcome as named data. In this role, it carries a name and attributes but no behavior, so readers can understand meaning without decoding arbitrary state assignments. section 1.3.2

Making retry decisions explicit

A ScheduledTask can store a RetryDecision status and assign concrete classes such as RetryImmediately, ReattemptLater, or Abandon. Scheduler code can then remove abandoned tasks with task.status() instanceof Abandon instead of inferring abandonment from scheduledAt == null.

Use classes to clarify the model when:

  • A fixed set of decisions is hidden behind variable assignments. section 1.3.2

How Data-Oriented Programming in Java covers it

How deep it goes
Defines classes through names and attributes, demonstrates state refactoring, and stops short of explaining how the data types connect.
Examples
Uses ScheduledTask, RetryImmediately, ReattemptLater, Abandon, and Scheduler examples to expose retry-state semantics.
What it assumes
Assumes familiarity with Java classes, fields, methods, and object-oriented code while deriving clearer modeling choices from a scheduling example.
What you can do after
Apply classes to refactor implicit state into explicit domain data and make downstream conditions easier to read.
How it connects
Connects classes with data orientation, object orientation, domain modeling, and explicit state transitions.

Also explained in

Compare how 27 books explain class →

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.