Design Patterns (GoF) (50 Qs)•Part 2: Behavioral Patterns & Communication (11 - 24)
What is the Repository Pattern and what are its benefits?
junior LevelBehavioral
In Simple Words: Mediates between the domain and data mapping layers, acting like an in-memory collection of domain objects:
- Encapsulates database query logic (
SELECT,INSERT) behind a collection-like interface (findById,save,delete). - Decouples domain logic from ORMs (Prisma, TypeORM, Hibernate) and SQL dialects.