(Catalog of Patterns of Enterprise Application Architecture):
- Objects and relational databases have different mechanisms for structuring
- Many parts of an object, such as collections and inheritance,
aren't present in relational databases.
- When you build an
object model with a lot of business logic it's valuable to use these
mechanisms (creo que se refiere a la herencia, etc.)
to better organize the data and the behavior that goes with
- Doing so leads to variant schemas; that is, the object
schema and the relational schema don't match up.
- You still need to transfer data between the two schemas, and this data
transfer becomes a complexity in its own right.
- If the in-memory objects
know about the relational database structure, changes in
one tend to ripple to the other.
- The Data Mapper is a layer of software that separates the in-memory
objects from the database.
- Its responsibility is to transfer data between
the two and also to isolate them from each other
Data Mapper the in-memory objects needn't know even that there's a
database present; they need no SQL interface code, and certainly no
knowledge of the database schema.
- (The database schema is always
ignorant of the objects that use it.)
Casiano Rodriguez León