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
