Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your example terms; DataMapper, DAO, DataTableGateway and Repository, all have a similar purpose (when I use one, I expect to get back a Customer object), but different intent/meaning and resulting implementation.</p> <p>A <strong>Repository</strong> <em>"acts like a collection, except with more elaborate querying capability"</em> [<a href="http://domaindrivendesign.org/books/evans_2003" rel="noreferrer">Evans, Domain Driven Design</a>] and may be considered as an <em>"objects in memory facade"</em> (<a href="http://geekswithblogs.net/gyoung/archive/2006/05/03/77171.aspx" rel="noreferrer">Repository discussion</a>)</p> <p>A <strong>DataMapper</strong> <em>"moves data between objects and a database while keeping them independent of each other and the mapper itself"</em> (<a href="http://martinfowler.com/eaaCatalog/dataMapper.html" rel="noreferrer">Fowler, PoEAA, Mapper</a>)</p> <p>A <strong>TableDataGateway</strong> is <em>"a Gateway (object that encapsulates access to an external system or resource) to a database table. One instance handles all the rows in the table</em>" (<a href="http://martinfowler.com/eaaCatalog/tableDataGateway.html" rel="noreferrer">Fowler, PoEAA, TableDataGateway</a>)</p> <p>A <strong>DAO</strong> <em>"separates a data resource's client interface from its data access mechanisms / adapts a specific data resource's access API to a generic client interface"</em> allowing <em>"data access mechanisms to change independently of the code that uses the data"</em> (<a href="http://www.oracle.com/technetwork/java/dao-138818.html" rel="noreferrer">Sun Blueprints</a>)</p> <p>Repository seems very generic, exposing no notion of database interaction. A DAO provides an interface enabling different underlying database implementations to be used. A TableDataGateway is specifically a thin wrapper around a single table. A DataMapper acts as an intermediary enabling the Model object to evolve independently of the database representation (over time).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload