Principles
Inversion of Control: Replace Hand-Wired Flow with Hooks
Inversion of control means the reusable code owns the flow and calls your code at fixed points, instead of your code calling everything. It lets a rule for every job live in one place. These lessons refactor warehouse night batches that each run their own loop into one runner that calls each job's hook.
Pick your language
When to use it
Use it when
Several jobs share one fixed flow, a start line, each item, a done line, and differ only in the work per item.
Skip it when
There is one job, or the flows really differ in order. A runner then adds a second place to read, with nothing shared to own.
Spot it by
The same loop with the same start and done lines copied into several classes, where a rule for all of them must be pasted into each.