Question 5 of 10Pro Only

What is the Repository pattern, and how does it differ from the Active Record pattern? When would you choose one over the other?

Sample answer preview

## Active Record Pattern In the Active Record pattern, domain objects directly handle their own persistence. Each object knows how to save, update, and delete itself in the database. ### Characteristics - Model class contains both data and database operations.

Repository patternActive Recorddata access layerpersistenceDomain-Driven Designseparation of concerns

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Full-Stack Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime