Repository: iluwatar/java-design-patterns
Issue: Ambiguity mapper pattern definition.
Labels: type: enhancement
epic: documentation

Ambiguity mapper pattern definition.
Defining the mapper model for a specific problem case (fetching data) that produces a definition is not correct.
we need an explanation on how/why to use this design template.

Issue comments:
Thank you so much for your interest @marouaneaba.

Please let us know if you are willing to work on this issue.
I'm not entirely sure what we need to do here. Please elaborate @marouaneaba what pattern are you referring to and where exactly do you see a problem?
> Ambiguity mapper pattern definition.
> Defining the mapper model for a specific problem case (fetching data) that produces a definition is not correct.
> we need an explanation on how/why to use this design template.

The explanation is indeed ambiguous.

Please provide a detailed explanation _(with line numbers if possible)_ to show us where exactly the problem lies so that we can investigate the matter and understand the issue with a clear picture in our mind. 

This would also help any fellow who is looking to resolve this issue as well and make us all understand the goal that we should have in mind while handling this issue.
Hello @ohbus @iluwatar ,
In the description, it is specified that the mapper should be used only for retrieving/mapped data from the database.
On the other hand, a mapper is a pattern which makes it possible to create an object in a single sence, is responsible for executing operations to construct the parameters of a constructor.
In another way, a mapper takes care of centralizing a set of operations that produces the arguments of a constructor to create an object.
@marouaneaba let's start from the basics.

1. Which pattern are you talking about? Please provide a direct link.
2. I understood that you see a problem in the pattern's `README.md` file, is that correct? Can you point out the exact line numbers there?
3. Since at the moment you seem to know the problem best and how to fix it, why not raise a pull request to fix it?

Hello,
I talk about this mapper pattern : https://github.com/iluwatar/java-design-patterns/tree/master/data-mapper.
The description used to describe this mapper pattern, it is too specific for retrieving data from the database.

- Description currently used:

Intent
A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself

Applicability
Use the Data Mapper in any of the following situations:
 -when you want to decouple data objects from DB access layer


- Mapper Pattern used for: 

Mapper is a pattern which makes it possible to create an object in a single sence, is responsible for executing operations to construct the parameters of a constructor.
In another way, a mapper takes care of centralizing a set of operations that produces the arguments of a constructor to create an object.


Yes I can contribute and thank you.



> Hello,
> I talk about this mapper pattern : https://github.com/iluwatar/java-design-patterns/tree/master/data-mapper.
> The description used to describe this mapper pattern, it is too specific for retrieving data from the database.
> 
> * Description currently used:
> 
> Intent
> A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself
> 
> Applicability
> Use the Data Mapper in any of the following situations:
> -when you want to decouple data objects from DB access layer
> 
> * Mapper Pattern used for:
> 
> Mapper is a pattern which makes it possible to create an object in a single sence, is responsible for executing operations to construct the parameters of a constructor.
> In another way, a mapper takes care of centralizing a set of operations that produces the arguments of a constructor to create an object.
> 
> Yes I can contribute and thank you.

⭐ Sure thing! Thanks for your interest in our project 😃 

✔️ Please mention a 📆 timeline 🕙 for when can we expect 🤔 a Pull Request against this issue.
Thanks @marouaneaba for the clarification. It looks like data mapper pattern's readme is not currently fulfilling our quality criteria (see https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute) and there's a lot to improve. We surely would appreciate your help here.
@marouaneaba Are you working on this issue?
As I can see @marouaneaba is not responding to any communications.

This issue is free to be taken again!
If this problem still needs to be solved, I think I can help, can this issue be assigned to me?
Ok @KyleSongxy, thanks for helping out

Pull request review comments:

Patch that resolved the issue:
diff --git a/data-mapper/README.md b/data-mapper/README.md
index 7766ca0b625c..b36414807612 100644
--- a/data-mapper/README.md
+++ b/data-mapper/README.md
@@ -3,21 +3,53 @@ title: Data Mapper
 category: Architectural
 language: en
 tags:
- - Decoupling
+- Decoupling
 ---
 
 ## Intent
 A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself
 
+This layer consists of one or more mappers (or data access objects) that perform data transfer. The scope of mapper implementations varies.
+A generic mapper will handle many different domain entity types, a dedicated mapper will handle one or a few.
+
+## Explanation
+
+Real-world example
+
+> When accessing web resources through a browser, there is generally no need to interact with the server directly;
+> the browser and the proxy server will complete the data acquisition operation, and the three will remain independent.
+
+In plain words
+
+> The data mapper will help complete the bi-directional transfer of persistence layer and in-memory data.
+
+Wikipedia says
+
+> A Data Mapper is a Data Access Layer that performs bidirectional transfer of data between a
+> persistent data store (often a relational database) and an in-memory data representation (the domain layer).
+
+Programmatic example
+
 ## Class diagram
 ![alt text](./etc/data-mapper.png "Data Mapper")
 
 ## Applicability
 Use the Data Mapper in any of the following situations
 
-* when you want to decouple data objects from DB access layer 
+* when you want to decouple data objects from DB access layer
 * when you want to write multiple data retrieval/persistence implementations
 
-## Credits
+## Known uses
+* [SqlSession.getMapper()](https://mybatis.org/mybatis-3/java-api.html)
+
+## Consequences
 
-* [Data Mapper](http://richard.jp.leguen.ca/tutoring/soen343-f2010/tutorials/implementing-data-mapper/)
+> Neatly mapped persistence layer data
+> Data model follows the single function principle
+
+## Related patterns
+* [Active Record Pattern](https://en.wikipedia.org/wiki/Active_record_pattern)
+* [Object–relational Mapping](https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping)
+
+## Credits
+* [Data Mapper](http://richard.jp.leguen.ca/tutoring/soen343-f2010/tutorials/implementing-data-mapper/)
\ No newline at end of file


Test patch: