A subtask is a smaller task that contributes to a larger task. Breaking work into subtasks makes separate responsibilities easier to understand and assign. section 20.1
A useful subtask has clear relationships with the surrounding work:
- Depends on earlier subtasks when it needs their outputs before it can begin. section 20.1
- Runs independently when it does not need another subtask’s work and can happen at the same time. section 20.1
- Hides unnecessary details behind a simple task description, while exposing needed inputs and outputs. section 20.1
- Can live in its own module environment, keeping created items separate unless information is explicitly passed through inputs or outputs. section 20.3
Ordering an item online
One large task becomes several subtasks: place the order, extract its details, find the item, make a shipping label, pack the item, and send it. Finding the item and making the label are independent; sending depends on both packing and labeling. The overall process can therefore be understood through each subtask without knowing every behind-the-scenes detail. 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.
Use the task diagram to trace each subtask’s inputs, outputs, and position in the larger ordering process. section 20.1
