A reusable subtask is a task whose steps can be used with different inputs to produce different outputs. Instead of creating a separate robot for every warehouse item, create one generic task that can find any requested item. The useful balance is making subtasks small enough to manage but general enough to reuse. section 20.1
When designing a subtask, ask:
- What inputs does it need before starting? section 20.1
- What output does it produce, if any? section 20.1
- Can the same steps work with different inputs? section 20.1
Ordering an item online
Break the larger task into smaller tasks such as finding an item, supplying item details, and arranging delivery. Each task can be viewed as a black box: focus on its inputs and outputs without needing every internal step. section 20.1
Figure 20.1. One possible way to divide the task of ordering an item online into smaller, self-contained, and reusable subtasks. Each gray box represents a task. Things to the left of the box are the inputs to a task, and things to the right are outputs of the task.
Follow the diagram to see an online-ordering task divided into self-contained subtasks, with inputs shown before each task and outputs afterward. section 20.1
