Results 1 to 1 of 1
Apr 30, 2013, 09:45 #1
- Join Date
- Apr 2013
- 6 Post(s)
- 1 Thread(s)
Data Mapper, separate finder and identity maps, what are the best practices?
Well in Martin Fowler's book about Data Mapper, he introduced two techniques of how to design mapper class. In the simple case he had a data mapper class taking care of both finder methods and create/update/delete methods, while in another example he separated a finder class from the mapper class. Also its interesting to note that he had an identity map stored in the mapper. Those are all neat-looking approaches, but I am a bit confused so I came with a few questions:
What is the reason behind separating finder class from data mapper? Is it applicable to PHP as well? When is it appropriate to attempt this?
Is it a better practice to store identity map inside the mapper class, or in the unit of work class? What are the benefits?
I'd appreciate it very much if anyone of you answer these questions. If any of the details confuse you, please lemme know.