repository pattern
compound.compound. a way of organizing computer code that separates how data is stored from how the rest of the program uses it. It acts like a middleman so the main program doesn't need to know if the data is in a database or a simple file.
compound. a design pattern that mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects. It decouples the application logic from the specific implementation details of data persistence.
The developer used the repository pattern to manage user data.
By implementing the repository pattern, the team was able to switch from a SQL database to a cloud-based storage system without changing the business logic.
The repository pattern facilitates cleaner unit testing by allowing developers to swap out the actual database connection for a mock object that simulates data retrieval.
A compound of the Latin-derived repository, denoting a place for storage, and the Middle English pattern, referring to a model or archetype. The specific architectural application was formalised by Martin Fowler and Edward Hieatt in 2003.
Etymology adapted from Wiktionary, available under CC BY-SA 4.0.
Commonly used in object-oriented programming and enterprise software architecture.
Last updated July 22, 2026