liveBook · Manning

Task instance

As explained in Data-Oriented Programming in Java

An instance is a concrete occurrence of a template or checklist carried out during a particular activity.

A task instance is a named run-through of a reusable template at a particular point in time. It records the work performed and its results, turning an abstract checklist into a concrete operational artifact. section 4.1.2

Model the distinction explicitly:

  • A template names the repeatable collection of steps. section 4.1.2
  • An instance identifies a particular run with a name, date, and template. section 4.1.3
  • Completion belongs to the instance rather than the template, preventing reusable steps from appearing already completed. section 4.1.3
  • Completed instances remain as data describing which operations were performed for a particular test. section 4.1.2

International travel checklist

A template can list Passport, Toothbrush, and Socks without completion state. Each time someone performs the checklist, a separate instance records the run and its step statuses. section 4.1.3

Listing 4.11 Trying a new approach: using a new type to track the status of a step
record Status(
    Step step,            #A
    Boolean isCompleted   #A
){}

Use a separate Status type to associate a step's completion state with a particular instance rather than embedding mutable state in the reusable template. section 4.1.3

How Data-Oriented Programming in Java covers it

How deep it goes
Defines instances, identifies their fields, and models completion separately while stopping short of broader lifecycle behavior.
Examples
Uses rocket operations, repeated checklist drills, flight-control procedures, and an international travel checklist.
What you can do after
Build it from scratch as a Java record linked to a template, with separate status records for completed steps.
How it connects
Connects task instances to checklists, templates, steps, completion status, and domain modeling.

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.