Glossary

ORM

ORM (Object-Relational Mapping) is a layer between your code and the database that lets you work with tables as objects. Instead of writing SQL queries, you work with classes and methods, and the ORM generates SQL for you.

Benefits and cost

ORM speeds up development, protects against SQL injection, and makes it easy to switch databases. The cost: overhead and the risk of inefficient queries. The classic example is the N+1 problem, where ORM fires a separate query per record instead of one JOIN.

Two patterns