# The clock is a dependency

A rate limiter is a pile of rules about time. Two a minute, a thousand an hour, and a denial that
reports how long to wait. The first implementation reads `Instant.now()` where it needs the time, and
for an afternoon that is fine.

Then you write the test. How do you watch a window turn? You wait for one.

`contrast/` holds both designs and measures the difference. `a/` reads the machine's clock, `b/` takes
a `Clock` in its constructor, and they are one line apart. The suite against `a/` spends **1.3 to 2.2
seconds** on two tests. The suite against `b/` stays **under 0.06** on four, and asserts more. `a/`
can only check that a `retryAfter` is no longer than one window, because it cannot choose where in
the window a request lands.

Then the interviewer adds a 30-second cool-off after a denial. Against `b/` that is checked in
**under 0.03 seconds**. Against `a/` there is no test under 30 seconds, because a test parameter can
be shrunk and a requirement cannot. `corpus/rate-limiter` is this at full size: 28 base tests, every one
driving a `ManualClock`, none of them asleep.

The diff instrument sees none of it. That cool-off cost the same **8** lines in both designs.

Inject what a test has to control, or what a second implementation already exists for. Construct the
rest in place. `corpus/file-system` depends on the `PathResolver` type and builds its own
`TreeResolver`, and left C3 off its tag list saying so.
