Chapter 11: Design

Leaky abstraction

An abstraction whose hidden detail shows through anyway, usually at the worst moment. The interface promises something simple, and what sits underneath forces you to care about it after all.

An agent works from the interface it can see. If real behaviour depends on something the interface doesn't mention, it will write code that passes against a fake and fails against the real thing, with a clean diff and green tests.

Say it to your agent

“Our cache interface hides Redis, which stores JSON, so dates come back as strings. Add a contract test that runs the same cases against the in-memory fake and a real Redis, and make the fake serialise too.”

The workshop

Name a word, or describe what you mean in everyday language.