27 lines
724 B
Markdown
Raw Permalink Normal View History

2016-04-06 13:14:10 +05:30
---
layout: pattern
title: Data Mapper
folder: data-mapper
permalink: /patterns/data-mapper/
categories: Architectural
language: en
2016-04-06 13:14:10 +05:30
tags:
- Decoupling
2016-04-06 13:14:10 +05:30
---
## Intent
A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself
## Class diagram
2016-04-06 13:14:10 +05:30
![alt text](./etc/data-mapper.png "Data Mapper")
## Applicability
Use the Data Mapper in any of the following situations
2016-04-06 13:18:42 +05:30
* when you want to decouple data objects from DB access layer
* when you want to write multiple data retrieval/persistence implementations
2016-04-06 13:14:10 +05:30
## Credits
* [Data Mapper](http://richard.jp.leguen.ca/tutoring/soen343-f2010/tutorials/implementing-data-mapper/)