The boundary between application code and storage: where business rules live, what queries get generated, and how the two stay consistent.
Topics
- Rules in Code and in Constraints
- Using database constraints for invariants that must never break, and application code for rules that need context.
- ORMs and Query Builders
- What object-relational mappers generate, when they help, and when to write the query yourself.
- Query Shape and the N+1 Problem
- Designing data access around what a page or job actually needs, in as few round trips as possible.
- Transaction Boundaries
- Deciding which changes must commit together, and keeping slow network calls out of open transactions.
- Data Access Layers
- Keeping storage details behind one module so schema changes don't ripple through the codebase.