Chapter 14: Data and failure

ORM

Also called Object-relational mapper

A library that lets you work with database rows as objects in your language, and writes the SQL for you. Prisma, Drizzle, Django and Active Record have one. It's convenient, and it hides how many queries a single innocent line of code will run.

An agent writes ORM code fluently, and the ORM makes the expensive thing look exactly like the cheap thing: order.customer.name might be a field you already have, or a trip to the database. You can't tell from the diff. So turn on query logging and read the SQL it really sends.

Say it to your agent

“Turn on SQL query logging for this test. Load the orders page and paste every statement it runs. Then use the ORM's eager loading so the customer arrives with the order, and show me the log again.”

The workshop

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