# Ask for the Book, Not the Shelf

Ask for the Book, Not the Shelf: Repository: Ask for the Book, Not the Shelf, Testing with Fakes: Why This Pays Off.

Updated: November 17, 2026

1. [Repository: Ask for the Book, Not the Shelf](https://www.ask-codey.com/lessons/dp-repository) (Journeyman): When the checkout service talks to the database in the database's own words (tables, rows, columns, dates stored as text), every class that needs loans copies that code, tests need a database, and a new database means editing them all; a repository puts loans behind one interface in the app's own words, so a class asks for a loan and never learns where it's kept.
2. [Testing with Fakes: Why This Pays Off](https://www.ask-codey.com/lessons/dp-testing-with-fakes) (Journeyman): Because the checkout service is handed its clock and its loan repository, a test can hand it a clock set to any day and loans kept in memory, so every late-fee rule and the five-book limit are checked in a few milliseconds, with no database and no waiting; this lesson writes those tests, names the kinds of stand-in (fakes, stubs and mocks), and says what they can't catch.

Source: https://www.ask-codey.com/courses/design-patterns/topics/dp-ask-for-the-book-not-the-shelf
