I´m pretty sure it´s not the gang of four. I have a feeling this is a newer pattern. Where was it first published/mentioned?

  • 4
    I would note that the authors of these books are very rarely the creator of the patterns. The gang of four explicitly say they didn't create them, they were just documenting commonly used patterns. – Tom Squires Feb 1 '12 at 12:02
  • 2
    "Design patterns" are never invented by anyone in particular. Design patterns are common elements of designs that repeatedly shows up in various successful designs. In most cases, it only makes sense to talk about who coined the terms or who first wrote about the pattern. – Lie Ryan Aug 25 '13 at 0:40

The earliest mention of it that I can find is in this paper, "An Introduction to Software Architecture", by David Garlan and Mary Shaw (1994, first published 1993). That predates the Gang of Four by a year, so it's an older pattern rather than a newer one.

Martin Fowler and Eric Evans have both mentioned it in their books and popularised it, but it's been around for a while.

  • Actually the GoF book was also published in the same year (says my memory... and Wikipedia too). And note that all of these patterns had been around for quite a while before getting published, so one can't really claim this pattern is older than that one, only that it was published earlier. – Péter Török Feb 1 '12 at 12:23
  • 1
    The paper was first published in 1993 though. Edited my answer to clarify! – Lunivore Feb 1 '12 at 13:36

I saw it first published in Martin Fowler's Patterns of Enterprise Application Architecture (2002).

Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.


For a full description see P of EAA page 322

A system with a complex domain model often benefits from a layer, such as the one provided by Data Mapper (165), that isolates domain objects from details of the database access code. In such systems it can be worthwhile to build another layer of abstraction over the mapping layer where query construction code is concentrated. This becomes more important when there are a large number of domain classes or heavy querying. In these cases particularly, adding this layer helps minimize duplicate query logic.

A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection. Client objects construct query specifications declaratively and submit them to Repository for satisfaction. Objects can be added to and removed from the Repository, as they can from a simple collection of objects, and the mapping code encapsulated by the Repository will carry out the appropriate operations behind the scenes. Conceptually, a Repository encapsulates the set of objects persisted in a data store and the operations performed over them, providing a more object-oriented view of the persistence layer. Repository also supports the objective of achieving a clean separation and one-way dependency between the domain and data mapping layers...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.