Why code generation beats hand-written DAL for any team under 20 engineers
Hand-written data access code feels like control. It is actually a tax.
Small teams write data access code by hand because they think it gives them control. What they actually get is a slowly diverging set of patterns, written by different engineers on different days, none of them tested as a system.
The hidden costs
- Three engineers, three opinions on transaction boundaries
- Every new entity becomes a small political negotiation
- Bugs cluster around the interface between hand-written code and the rest of the system
- Onboarding cost grows linearly with the size of the DAL
A generated DAL has none of these. It is consistent because a compiler enforces consistency. It is testable because the same code is generated across every project. It is faster to write, by definition, because nobody is writing it.
When hand-rolling actually wins
If you have 50+ engineers and a deep platform team, hand-rolled DAL with shared libraries can match a generator. Below that, it cannot. The math does not work.
Generated code is not lazy. It is the highest-leverage form of seriousness.